From 67a643f16b1bd4e569f8e96b8a45f7ab9bb46cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A7=E9=A9=8A?= Date: Thu, 22 Aug 2024 15:13:47 +0000 Subject: [PATCH] fix miss file (#2) Co-authored-by: daniel.w Reviewed-on: https://code.30cm.net/digimon/app-cloudep-member-server/pulls/2 --- generate/protobuf/service.proto | 4 +- internal/logic/account/get_user_info_logic.go | 24 ++++-- internal/logic/account/list_member_logic.go | 5 +- .../account/verify_refresh_code_logic.go | 2 +- internal/mock/model/account_model.go | 14 ++++ internal/mock/model/user_table_model.go | 74 +++++++++++++++++++ 6 files changed, 114 insertions(+), 9 deletions(-) diff --git a/generate/protobuf/service.proto b/generate/protobuf/service.proto index 19bcffe..291f998 100644 --- a/generate/protobuf/service.proto +++ b/generate/protobuf/service.proto @@ -143,7 +143,9 @@ message UserInfo { string language = 5; string currency = 6; string avatar = 7; - optional string nick_name = 8; + int64 create_time=8; + int64 update_time=9; + optional string nick_name = 10; } message GetUserInfoResp { diff --git a/internal/logic/account/get_user_info_logic.go b/internal/logic/account/get_user_info_logic.go index 4e37b5b..1d96b48 100644 --- a/internal/logic/account/get_user_info_logic.go +++ b/internal/logic/account/get_user_info_logic.go @@ -1,15 +1,14 @@ package accountlogic import ( + "app-cloudep-member-server/gen_result/pb/member" "app-cloudep-member-server/internal/model" + "app-cloudep-member-server/internal/svc" + ers "code.30cm.net/digimon/library-go/errors" "context" - ers "code.30cm.net/digimon/library-go/errors" - - "app-cloudep-member-server/gen_result/pb/member" - "app-cloudep-member-server/internal/svc" - "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/protobuf/proto" ) type GetUserInfoLogic struct { @@ -47,7 +46,20 @@ func (l *GetUserInfoLogic) GetUserInfo(in *member.GetUserInfoReq) (*member.GetUs } if entity != nil { - return &member.GetUserInfoResp{}, nil + return &member.GetUserInfoResp{ + Data: &member.UserInfo{ + Uid: entity.Uid, + AlarmType: member.AlarmType(entity.AlarmType), + VerifyType: member.VerifyType(entity.VerifyType), + Status: member.MemberStatus(entity.Status), + NickName: proto.String(entity.NickName), + Language: entity.Language, + Currency: entity.Currency, + Avatar: entity.Avatar, + CreateTime: entity.CreateTime, + UpdateTime: entity.UpdateTime, + }, + }, nil } return nil, ers.ResourceNotFound("filed to get user info") diff --git a/internal/logic/account/list_member_logic.go b/internal/logic/account/list_member_logic.go index 740056b..7e2b8cf 100644 --- a/internal/logic/account/list_member_logic.go +++ b/internal/logic/account/list_member_logic.go @@ -5,6 +5,7 @@ import ( "app-cloudep-member-server/internal/model" "context" "fmt" + "google.golang.org/protobuf/proto" "strconv" ers "code.30cm.net/digimon/library-go/errors" @@ -56,7 +57,9 @@ func (l *ListMemberLogic) ListMember(in *member.ListUserInfoReq) (*member.ListUs Status: member.MemberStatus(item.Status), Language: item.Language, Currency: item.Currency, - NickName: &item.NickName, + NickName: proto.String(item.NickName), + CreateTime: item.CreateTime, + UpdateTime: item.UpdateTime, Avatar: item.Avatar, }) } diff --git a/internal/logic/account/verify_refresh_code_logic.go b/internal/logic/account/verify_refresh_code_logic.go index 23a22f0..76417dd 100644 --- a/internal/logic/account/verify_refresh_code_logic.go +++ b/internal/logic/account/verify_refresh_code_logic.go @@ -50,7 +50,7 @@ func (l *VerifyRefreshCodeLogic) VerifyRefreshCode(in *member.VerifyRefreshCodeR return nil, ers.DBError("failed to get data from redis") } - if get != fmt.Sprintf("%d", in.CodeType) { + if get != fmt.Sprintf("%s", in.VerifyCode) { return nil, ers.ArkInternal("Illegible Verify Code") } diff --git a/internal/mock/model/account_model.go b/internal/mock/model/account_model.go index b2a650b..77ae77b 100644 --- a/internal/mock/model/account_model.go +++ b/internal/mock/model/account_model.go @@ -113,3 +113,17 @@ func (mr *MockAccountModelMockRecorder) Update(ctx, data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockAccountModel)(nil).Update), ctx, data) } + +// UpdateTokenByLoginID mocks base method. +func (m *MockAccountModel) UpdateTokenByLoginID(ctx context.Context, account, token string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateTokenByLoginID", ctx, account, token) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateTokenByLoginID indicates an expected call of UpdateTokenByLoginID. +func (mr *MockAccountModelMockRecorder) UpdateTokenByLoginID(ctx, account, token any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTokenByLoginID", reflect.TypeOf((*MockAccountModel)(nil).UpdateTokenByLoginID), ctx, account, token) +} diff --git a/internal/mock/model/user_table_model.go b/internal/mock/model/user_table_model.go index 7370944..859badc 100644 --- a/internal/mock/model/user_table_model.go +++ b/internal/mock/model/user_table_model.go @@ -10,6 +10,7 @@ package mock import ( + member "app-cloudep-member-server/gen_result/pb/member" model "app-cloudep-member-server/internal/model" context "context" sql "database/sql" @@ -41,6 +42,21 @@ func (m *MockUserTableModel) EXPECT() *MockUserTableModelMockRecorder { return m.recorder } +// Count mocks base method. +func (m *MockUserTableModel) Count(ctx context.Context) (int64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Count", ctx) + ret0, _ := ret[0].(int64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Count indicates an expected call of Count. +func (mr *MockUserTableModelMockRecorder) Count(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockUserTableModel)(nil).Count), ctx) +} + // Delete mocks base method. func (m *MockUserTableModel) Delete(ctx context.Context, id int64) error { m.ctrl.T.Helper() @@ -70,6 +86,21 @@ func (mr *MockUserTableModelMockRecorder) FindOne(ctx, id any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindOne", reflect.TypeOf((*MockUserTableModel)(nil).FindOne), ctx, id) } +// FindOneByNickName mocks base method. +func (m *MockUserTableModel) FindOneByNickName(ctx context.Context, uid string) (*model.UserTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindOneByNickName", ctx, uid) + ret0, _ := ret[0].(*model.UserTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindOneByNickName indicates an expected call of FindOneByNickName. +func (mr *MockUserTableModelMockRecorder) FindOneByNickName(ctx, uid any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindOneByNickName", reflect.TypeOf((*MockUserTableModel)(nil).FindOneByNickName), ctx, uid) +} + // FindOneByUid mocks base method. func (m *MockUserTableModel) FindOneByUid(ctx context.Context, uid string) (*model.UserTable, error) { m.ctrl.T.Helper() @@ -100,6 +131,21 @@ func (mr *MockUserTableModelMockRecorder) Insert(ctx, data any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockUserTableModel)(nil).Insert), ctx, data) } +// ListMembers mocks base method. +func (m *MockUserTableModel) ListMembers(ctx context.Context, params *model.UserQueryParams) ([]*model.UserTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMembers", ctx, params) + ret0, _ := ret[0].([]*model.UserTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListMembers indicates an expected call of ListMembers. +func (mr *MockUserTableModelMockRecorder) ListMembers(ctx, params any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMembers", reflect.TypeOf((*MockUserTableModel)(nil).ListMembers), ctx, params) +} + // Update mocks base method. func (m *MockUserTableModel) Update(ctx context.Context, data *model.UserTable) error { m.ctrl.T.Helper() @@ -113,3 +159,31 @@ func (mr *MockUserTableModelMockRecorder) Update(ctx, data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockUserTableModel)(nil).Update), ctx, data) } + +// UpdateSome mocks base method. +func (m *MockUserTableModel) UpdateSome(ctx context.Context, newData *member.UpdateUserInfoReq) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSome", ctx, newData) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateSome indicates an expected call of UpdateSome. +func (mr *MockUserTableModelMockRecorder) UpdateSome(ctx, newData any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSome", reflect.TypeOf((*MockUserTableModel)(nil).UpdateSome), ctx, newData) +} + +// UpdateStatus mocks base method. +func (m *MockUserTableModel) UpdateStatus(ctx context.Context, uid string, status int32) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStatus", ctx, uid, status) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateStatus indicates an expected call of UpdateStatus. +func (mr *MockUserTableModelMockRecorder) UpdateStatus(ctx, uid, status any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStatus", reflect.TypeOf((*MockUserTableModel)(nil).UpdateStatus), ctx, uid, status) +}