1
All checks were successful
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 38s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 42s
Auth & User Management Service CI / start-services (push) Successful in 9s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 41s
All checks were successful
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 38s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 42s
Auth & User Management Service CI / start-services (push) Successful in 9s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 41s
This commit is contained in:
parent
90f1d6eecf
commit
5490a76650
@ -21,6 +21,8 @@ message Code2SessionResponse{
|
|||||||
string OpenId = 1;
|
string OpenId = 1;
|
||||||
string UnionId = 2;
|
string UnionId = 2;
|
||||||
uint64 UserId = 3;
|
uint64 UserId = 3;
|
||||||
|
uint32 AppId = 4;
|
||||||
|
bool IsNew = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetAccessTokenRequest{
|
message GetAccessTokenRequest{
|
||||||
|
@ -174,6 +174,8 @@ type Code2SessionResponse struct {
|
|||||||
OpenId string `protobuf:"bytes,1,opt,name=OpenId,proto3" json:"OpenId,omitempty"`
|
OpenId string `protobuf:"bytes,1,opt,name=OpenId,proto3" json:"OpenId,omitempty"`
|
||||||
UnionId string `protobuf:"bytes,2,opt,name=UnionId,proto3" json:"UnionId,omitempty"`
|
UnionId string `protobuf:"bytes,2,opt,name=UnionId,proto3" json:"UnionId,omitempty"`
|
||||||
UserId uint64 `protobuf:"varint,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
UserId uint64 `protobuf:"varint,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||||
|
AppId uint32 `protobuf:"varint,4,opt,name=AppId,proto3" json:"AppId,omitempty"`
|
||||||
|
IsNew bool `protobuf:"varint,5,opt,name=IsNew,proto3" json:"IsNew,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -229,6 +231,20 @@ func (x *Code2SessionResponse) GetUserId() uint64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Code2SessionResponse) GetAppId() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AppId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Code2SessionResponse) GetIsNew() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsNew
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type GetAccessTokenRequest struct {
|
type GetAccessTokenRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
AppId string `protobuf:"bytes,1,opt,name=AppId,proto3" json:"AppId,omitempty"`
|
AppId string `protobuf:"bytes,1,opt,name=AppId,proto3" json:"AppId,omitempty"`
|
||||||
@ -332,37 +348,40 @@ var file_auth_service_proto_rawDesc = string([]byte{
|
|||||||
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f,
|
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f,
|
||||||
0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x43,
|
0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x43,
|
||||||
0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79,
|
0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79,
|
||||||
0x6d, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x60, 0x0a, 0x14, 0x43, 0x6f, 0x64, 0x65,
|
0x6d, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x64,
|
||||||
0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
0x65, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x52, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x55, 0x6e, 0x69, 0x6f,
|
0x09, 0x52, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x55, 0x6e, 0x69,
|
||||||
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
|
0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x6e, 0x69, 0x6f,
|
||||||
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20,
|
||||||
0x28, 0x04, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x15, 0x47, 0x65,
|
0x01, 0x28, 0x04, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41,
|
||||||
0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75,
|
0x70, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49,
|
||||||
0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
0x64, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x73, 0x4e, 0x65, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
|
||||||
0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x16, 0x47, 0x65, 0x74,
|
0x52, 0x05, 0x49, 0x73, 0x4e, 0x65, 0x77, 0x22, 0x2d, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x63,
|
||||||
0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b,
|
0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
|
0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63,
|
||||||
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf9, 0x01, 0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73,
|
0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15,
|
0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
|
||||||
0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65,
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b,
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72,
|
0x65, 0x6e, 0x32, 0xf9, 0x01, 0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a,
|
0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x61, 0x75,
|
||||||
0x0c, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e,
|
0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
|
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||||
|
0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x43, 0x6f,
|
||||||
|
0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x75, 0x74,
|
||||||
|
0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53,
|
||||||
|
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e,
|
||||||
0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64,
|
0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64,
|
||||||
0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x1a, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
0x65, 0x12, 0x5b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f,
|
||||||
0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
0x6b, 0x65, 0x6e, 0x12, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73,
|
0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65,
|
||||||
0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65,
|
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f,
|
||||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54,
|
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73,
|
||||||
0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75,
|
0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10,
|
||||||
0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63,
|
0x5a, 0x0e, 0x2e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x65, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
|
||||||
0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -48,6 +48,7 @@ func (l *Code2SessionLogic) Code2Session(in *auth_service.Code2SessionRequest) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isNew bool
|
||||||
//如果没有用户id,则创建一个空用户
|
//如果没有用户id,则创建一个空用户
|
||||||
if auModel.UserID == nil {
|
if auModel.UserID == nil {
|
||||||
userId, err := l.svcCtx.UserManagerClient.CreateEmptyUser(l.ctx, &user_management.Empty{})
|
userId, err := l.svcCtx.UserManagerClient.CreateEmptyUser(l.ctx, &user_management.Empty{})
|
||||||
@ -55,11 +56,18 @@ func (l *Code2SessionLogic) Code2Session(in *auth_service.Code2SessionRequest) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
auModel.UserID = &userId.UserId
|
auModel.UserID = &userId.UserId
|
||||||
|
} else {
|
||||||
|
user, err := l.svcCtx.UserManagerClient.FindById(l.ctx, &user_management.UserId{UserId: *auModel.UserID})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
isNew = user.IsNew
|
||||||
}
|
}
|
||||||
|
|
||||||
return &auth_service.Code2SessionResponse{
|
return &auth_service.Code2SessionResponse{
|
||||||
OpenId: res.OpenID,
|
OpenId: res.OpenID,
|
||||||
UnionId: res.UnionID,
|
UnionId: res.UnionID,
|
||||||
UserId: *auModel.UserID,
|
UserId: *auModel.UserID,
|
||||||
|
IsNew: isNew,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ const TableNameUser = "user"
|
|||||||
// User mapped from table <user>
|
// User mapped from table <user>
|
||||||
type User struct {
|
type User struct {
|
||||||
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement:true;index:idx_app_user_id,priority:1" json:"id"`
|
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement:true;index:idx_app_user_id,priority:1" json:"id"`
|
||||||
|
IsNew uint32 `gorm:"column:is_new;type:tinyint unsigned;not null" json:"is_new"`
|
||||||
Nickname string `gorm:"column:nickname;type:varchar(255);not null;comment:昵称" json:"nickname"` // 昵称
|
Nickname string `gorm:"column:nickname;type:varchar(255);not null;comment:昵称" json:"nickname"` // 昵称
|
||||||
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"` // 头像
|
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"` // 头像
|
||||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
|
@ -28,6 +28,7 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
|||||||
tableName := _user.userDo.TableName()
|
tableName := _user.userDo.TableName()
|
||||||
_user.ALL = field.NewAsterisk(tableName)
|
_user.ALL = field.NewAsterisk(tableName)
|
||||||
_user.ID = field.NewUint64(tableName, "id")
|
_user.ID = field.NewUint64(tableName, "id")
|
||||||
|
_user.IsNew = field.NewUint32(tableName, "is_new")
|
||||||
_user.Nickname = field.NewString(tableName, "nickname")
|
_user.Nickname = field.NewString(tableName, "nickname")
|
||||||
_user.Avatar = field.NewString(tableName, "avatar")
|
_user.Avatar = field.NewString(tableName, "avatar")
|
||||||
_user.CreatedAt = field.NewTime(tableName, "created_at")
|
_user.CreatedAt = field.NewTime(tableName, "created_at")
|
||||||
@ -43,6 +44,7 @@ type user struct {
|
|||||||
|
|
||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ID field.Uint64
|
ID field.Uint64
|
||||||
|
IsNew field.Uint32
|
||||||
Nickname field.String // 昵称
|
Nickname field.String // 昵称
|
||||||
Avatar field.String // 头像
|
Avatar field.String // 头像
|
||||||
CreatedAt field.Time // 创建时间
|
CreatedAt field.Time // 创建时间
|
||||||
@ -64,6 +66,7 @@ func (u user) As(alias string) *user {
|
|||||||
func (u *user) updateTableName(table string) *user {
|
func (u *user) updateTableName(table string) *user {
|
||||||
u.ALL = field.NewAsterisk(table)
|
u.ALL = field.NewAsterisk(table)
|
||||||
u.ID = field.NewUint64(table, "id")
|
u.ID = field.NewUint64(table, "id")
|
||||||
|
u.IsNew = field.NewUint32(table, "is_new")
|
||||||
u.Nickname = field.NewString(table, "nickname")
|
u.Nickname = field.NewString(table, "nickname")
|
||||||
u.Avatar = field.NewString(table, "avatar")
|
u.Avatar = field.NewString(table, "avatar")
|
||||||
u.CreatedAt = field.NewTime(table, "created_at")
|
u.CreatedAt = field.NewTime(table, "created_at")
|
||||||
@ -92,8 +95,9 @@ func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *user) fillFieldMap() {
|
func (u *user) fillFieldMap() {
|
||||||
u.fieldMap = make(map[string]field.Expr, 5)
|
u.fieldMap = make(map[string]field.Expr, 6)
|
||||||
u.fieldMap["id"] = u.ID
|
u.fieldMap["id"] = u.ID
|
||||||
|
u.fieldMap["is_new"] = u.IsNew
|
||||||
u.fieldMap["nickname"] = u.Nickname
|
u.fieldMap["nickname"] = u.Nickname
|
||||||
u.fieldMap["avatar"] = u.Avatar
|
u.fieldMap["avatar"] = u.Avatar
|
||||||
u.fieldMap["created_at"] = u.CreatedAt
|
u.fieldMap["created_at"] = u.CreatedAt
|
||||||
|
38
app/user_management/internal/logic/find_by_id_logic.go
Normal file
38
app/user_management/internal/logic/find_by_id_logic.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FindByIdLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFindByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindByIdLogic {
|
||||||
|
return &FindByIdLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindById 创建用户或者获取用户
|
||||||
|
func (l *FindByIdLogic) FindById(in *user_management.UserId) (*user_management.User, error) {
|
||||||
|
userModel, err := l.svcCtx.Query.User.WithContext(l.ctx).Where(l.svcCtx.Query.User.ID.Eq(in.GetUserId())).FirstOrCreate()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &user_management.User{
|
||||||
|
ID: userModel.ID,
|
||||||
|
Nickname: userModel.Nickname,
|
||||||
|
Avatar: userModel.Avatar,
|
||||||
|
IsNew: userModel.IsNew == 1,
|
||||||
|
}, nil
|
||||||
|
}
|
@ -46,6 +46,12 @@ func (s *UserManagementServer) CreateEmptyUser(ctx context.Context, in *user_man
|
|||||||
return l.CreateEmptyUser(in)
|
return l.CreateEmptyUser(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
func (s *UserManagementServer) FindById(ctx context.Context, in *user_management.UserId) (*user_management.User, error) {
|
||||||
|
l := logic.NewFindByIdLogic(ctx, s.svcCtx)
|
||||||
|
return l.FindById(in)
|
||||||
|
}
|
||||||
|
|
||||||
// GetUserById 通过 ID 获取用户
|
// GetUserById 通过 ID 获取用户
|
||||||
func (s *UserManagementServer) GetUserById(ctx context.Context, in *user_management.UserId) (*user_management.User, error) {
|
func (s *UserManagementServer) GetUserById(ctx context.Context, in *user_management.UserId) (*user_management.User, error) {
|
||||||
l := logic.NewGetUserByIdLogic(ctx, s.svcCtx)
|
l := logic.NewGetUserByIdLogic(ctx, s.svcCtx)
|
||||||
|
@ -36,6 +36,7 @@ message User {
|
|||||||
uint64 ID = 1;
|
uint64 ID = 1;
|
||||||
string Nickname = 2;
|
string Nickname = 2;
|
||||||
string Avatar = 3;
|
string Avatar = 3;
|
||||||
|
bool IsNew = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
service user_management {
|
service user_management {
|
||||||
@ -50,6 +51,9 @@ service user_management {
|
|||||||
//CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
//CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||||
rpc CreateEmptyUser(Empty) returns(UserId);
|
rpc CreateEmptyUser(Empty) returns(UserId);
|
||||||
|
|
||||||
|
//FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
rpc FindById(UserId) returns(User);
|
||||||
|
|
||||||
//GetUserById 通过 ID 获取用户
|
//GetUserById 通过 ID 获取用户
|
||||||
rpc GetUserById(UserId) returns(User);
|
rpc GetUserById(UserId) returns(User);
|
||||||
}
|
}
|
||||||
|
@ -350,6 +350,7 @@ type User struct {
|
|||||||
ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
|
ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
|
||||||
Nickname string `protobuf:"bytes,2,opt,name=Nickname,proto3" json:"Nickname,omitempty"`
|
Nickname string `protobuf:"bytes,2,opt,name=Nickname,proto3" json:"Nickname,omitempty"`
|
||||||
Avatar string `protobuf:"bytes,3,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
|
Avatar string `protobuf:"bytes,3,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
|
||||||
|
IsNew bool `protobuf:"varint,4,opt,name=IsNew,proto3" json:"IsNew,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -405,6 +406,13 @@ func (x *User) GetAvatar() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *User) GetIsNew() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsNew
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_user_management_proto protoreflect.FileDescriptor
|
var File_user_management_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_user_management_proto_rawDesc = string([]byte{
|
var file_user_management_proto_rawDesc = string([]byte{
|
||||||
@ -431,36 +439,41 @@ var file_user_management_proto_rawDesc = string([]byte{
|
|||||||
0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x20, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
|
0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x20, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
|
||||||
0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52,
|
0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52,
|
||||||
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
||||||
0x22, 0x4a, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01,
|
0x22, 0x60, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
||||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
||||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03,
|
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x32, 0xea, 0x02, 0x0a,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
0x49, 0x73, 0x4e, 0x65, 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, 0x4e,
|
||||||
0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
0x65, 0x77, 0x32, 0xa6, 0x03, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61,
|
||||||
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18,
|
||||||
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||||
0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a,
|
0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||||
0x07, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73,
|
0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x07, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f,
|
||||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x55,
|
0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x43,
|
0x20, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e,
|
||||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
0x74, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
0x65, 0x12, 0x49, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,
|
||||||
0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e,
|
||||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
|
0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67,
|
||||||
0x45, 0x6d, 0x70, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x0f,
|
||||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12,
|
||||||
0x79, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d,
|
0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e,
|
||||||
0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0b, 0x47, 0x65,
|
0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d,
|
||||||
0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x12, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72,
|
0x12, 0x3a, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x12, 0x17, 0x2e, 0x75,
|
||||||
0x49, 0x64, 0x1a, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55,
|
||||||
0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x75,
|
0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e,
|
||||||
0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06,
|
0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0b,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x12, 0x17, 0x2e, 0x75, 0x73,
|
||||||
|
0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73,
|
||||||
|
0x65, 0x72, 0x49, 0x64, 0x1a, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61,
|
||||||
|
0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x13, 0x5a, 0x11, 0x2e,
|
||||||
|
0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
})
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -491,14 +504,16 @@ var file_user_management_proto_depIdxs = []int32{
|
|||||||
2, // 1: user_management.user_management.SetUser:input_type -> user_management.SetUserRequest
|
2, // 1: user_management.user_management.SetUser:input_type -> user_management.SetUserRequest
|
||||||
4, // 2: user_management.user_management.CreateUser:input_type -> user_management.CreateUserRequest
|
4, // 2: user_management.user_management.CreateUser:input_type -> user_management.CreateUserRequest
|
||||||
6, // 3: user_management.user_management.CreateEmptyUser:input_type -> user_management.Empty
|
6, // 3: user_management.user_management.CreateEmptyUser:input_type -> user_management.Empty
|
||||||
5, // 4: user_management.user_management.GetUserById:input_type -> user_management.UserId
|
5, // 4: user_management.user_management.FindById:input_type -> user_management.UserId
|
||||||
1, // 5: user_management.user_management.Ping:output_type -> user_management.Response
|
5, // 5: user_management.user_management.GetUserById:input_type -> user_management.UserId
|
||||||
3, // 6: user_management.user_management.SetUser:output_type -> user_management.SetUserResponse
|
1, // 6: user_management.user_management.Ping:output_type -> user_management.Response
|
||||||
5, // 7: user_management.user_management.CreateUser:output_type -> user_management.UserId
|
3, // 7: user_management.user_management.SetUser:output_type -> user_management.SetUserResponse
|
||||||
5, // 8: user_management.user_management.CreateEmptyUser:output_type -> user_management.UserId
|
5, // 8: user_management.user_management.CreateUser:output_type -> user_management.UserId
|
||||||
7, // 9: user_management.user_management.GetUserById:output_type -> user_management.User
|
5, // 9: user_management.user_management.CreateEmptyUser:output_type -> user_management.UserId
|
||||||
5, // [5:10] is the sub-list for method output_type
|
7, // 10: user_management.user_management.FindById:output_type -> user_management.User
|
||||||
0, // [0:5] is the sub-list for method input_type
|
7, // 11: user_management.user_management.GetUserById:output_type -> user_management.User
|
||||||
|
6, // [6:12] is the sub-list for method output_type
|
||||||
|
0, // [0:6] is the sub-list for method input_type
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
0, // [0:0] is the sub-list for field type_name
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
@ -23,6 +23,7 @@ const (
|
|||||||
UserManagement_SetUser_FullMethodName = "/user_management.user_management/SetUser"
|
UserManagement_SetUser_FullMethodName = "/user_management.user_management/SetUser"
|
||||||
UserManagement_CreateUser_FullMethodName = "/user_management.user_management/CreateUser"
|
UserManagement_CreateUser_FullMethodName = "/user_management.user_management/CreateUser"
|
||||||
UserManagement_CreateEmptyUser_FullMethodName = "/user_management.user_management/CreateEmptyUser"
|
UserManagement_CreateEmptyUser_FullMethodName = "/user_management.user_management/CreateEmptyUser"
|
||||||
|
UserManagement_FindById_FullMethodName = "/user_management.user_management/FindById"
|
||||||
UserManagement_GetUserById_FullMethodName = "/user_management.user_management/GetUserById"
|
UserManagement_GetUserById_FullMethodName = "/user_management.user_management/GetUserById"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,6 +38,8 @@ type UserManagementClient interface {
|
|||||||
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
||||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||||
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
||||||
|
// FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||||
// GetUserById 通过 ID 获取用户
|
// GetUserById 通过 ID 获取用户
|
||||||
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||||
}
|
}
|
||||||
@ -89,6 +92,16 @@ func (c *userManagementClient) CreateEmptyUser(ctx context.Context, in *Empty, o
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *userManagementClient) FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(User)
|
||||||
|
err := c.cc.Invoke(ctx, UserManagement_FindById_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *userManagementClient) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
func (c *userManagementClient) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(User)
|
out := new(User)
|
||||||
@ -110,6 +123,8 @@ type UserManagementServer interface {
|
|||||||
CreateUser(context.Context, *CreateUserRequest) (*UserId, error)
|
CreateUser(context.Context, *CreateUserRequest) (*UserId, error)
|
||||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||||
CreateEmptyUser(context.Context, *Empty) (*UserId, error)
|
CreateEmptyUser(context.Context, *Empty) (*UserId, error)
|
||||||
|
// FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
FindById(context.Context, *UserId) (*User, error)
|
||||||
// GetUserById 通过 ID 获取用户
|
// GetUserById 通过 ID 获取用户
|
||||||
GetUserById(context.Context, *UserId) (*User, error)
|
GetUserById(context.Context, *UserId) (*User, error)
|
||||||
mustEmbedUnimplementedUserManagementServer()
|
mustEmbedUnimplementedUserManagementServer()
|
||||||
@ -134,6 +149,9 @@ func (UnimplementedUserManagementServer) CreateUser(context.Context, *CreateUser
|
|||||||
func (UnimplementedUserManagementServer) CreateEmptyUser(context.Context, *Empty) (*UserId, error) {
|
func (UnimplementedUserManagementServer) CreateEmptyUser(context.Context, *Empty) (*UserId, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateEmptyUser not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateEmptyUser not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedUserManagementServer) FindById(context.Context, *UserId) (*User, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindById not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedUserManagementServer) GetUserById(context.Context, *UserId) (*User, error) {
|
func (UnimplementedUserManagementServer) GetUserById(context.Context, *UserId) (*User, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserById not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetUserById not implemented")
|
||||||
}
|
}
|
||||||
@ -230,6 +248,24 @@ func _UserManagement_CreateEmptyUser_Handler(srv interface{}, ctx context.Contex
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _UserManagement_FindById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UserId)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserManagementServer).FindById(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: UserManagement_FindById_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserManagementServer).FindById(ctx, req.(*UserId))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _UserManagement_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _UserManagement_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(UserId)
|
in := new(UserId)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -271,6 +307,10 @@ var UserManagement_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "CreateEmptyUser",
|
MethodName: "CreateEmptyUser",
|
||||||
Handler: _UserManagement_CreateEmptyUser_Handler,
|
Handler: _UserManagement_CreateEmptyUser_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindById",
|
||||||
|
Handler: _UserManagement_FindById_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetUserById",
|
MethodName: "GetUserById",
|
||||||
Handler: _UserManagement_GetUserById_Handler,
|
Handler: _UserManagement_GetUserById_Handler,
|
||||||
|
@ -31,6 +31,8 @@ type (
|
|||||||
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
||||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||||
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
||||||
|
// FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||||
// GetUserById 通过 ID 获取用户
|
// GetUserById 通过 ID 获取用户
|
||||||
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||||
}
|
}
|
||||||
@ -69,6 +71,12 @@ func (m *defaultUserManagement) CreateEmptyUser(ctx context.Context, in *Empty,
|
|||||||
return client.CreateEmptyUser(ctx, in, opts...)
|
return client.CreateEmptyUser(ctx, in, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FirstOrCreateUser 创建用户或者获取用户
|
||||||
|
func (m *defaultUserManagement) FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||||
|
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||||
|
return client.FindById(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
// GetUserById 通过 ID 获取用户
|
// GetUserById 通过 ID 获取用户
|
||||||
func (m *defaultUserManagement) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
func (m *defaultUserManagement) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user