youtu_grpc/app/user/internal/server/user_server.go

60 lines
1.8 KiB
Go
Raw Normal View History

2025-02-07 15:18:26 +08:00
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
2025-02-14 10:30:15 +08:00
// Source: user.proto
2025-02-07 15:18:26 +08:00
package server
import (
"context"
2025-02-14 10:43:28 +08:00
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user/internal/logic"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user/internal/svc"
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user/user"
2025-02-07 15:18:26 +08:00
)
type UserManagementServer struct {
svcCtx *svc.ServiceContext
2025-02-14 10:30:15 +08:00
user.UnimplementedUserManagementServer
2025-02-07 15:18:26 +08:00
}
func NewUserManagementServer(svcCtx *svc.ServiceContext) *UserManagementServer {
return &UserManagementServer{
svcCtx: svcCtx,
}
}
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) Ping(ctx context.Context, in *user.Request) (*user.Response, error) {
l := logic.NewPingLogic(ctx, s.svcCtx)
2025-02-07 15:18:26 +08:00
return l.Ping(in)
}
// SetUser 设置用户信息
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) SetUser(ctx context.Context, in *user.SetUserRequest) (*user.SetUserResponse, error) {
l := logic.NewSetUserLogic(ctx, s.svcCtx)
return l.SetUser(in)
}
// CreateUser 获取用户或者创建用户
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) CreateUser(ctx context.Context, in *user.CreateUserRequest) (*user.UserId, error) {
l := logic.NewCreateUserLogic(ctx, s.svcCtx)
return l.CreateUser(in)
}
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) CreateEmptyUser(ctx context.Context, in *user.Empty) (*user.UserId, error) {
l := logic.NewCreateEmptyUserLogic(ctx, s.svcCtx)
return l.CreateEmptyUser(in)
}
2025-02-12 18:10:25 +08:00
// FirstOrCreateUser 创建用户或者获取用户
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) FindById(ctx context.Context, in *user.UserId) (*user.User, error) {
2025-02-12 18:10:25 +08:00
l := logic.NewFindByIdLogic(ctx, s.svcCtx)
return l.FindById(in)
}
// GetUserById 通过 ID 获取用户
2025-02-14 10:30:15 +08:00
func (s *UserManagementServer) GetUserById(ctx context.Context, in *user.UserId) (*user.User, error) {
l := logic.NewGetUserByIdLogic(ctx, s.svcCtx)
return l.GetUserById(in)
2025-02-07 15:18:26 +08:00
}