initial commit
This commit is contained in:
54
user/internal/server/userserver.go
Normal file
54
user/internal/server/userserver.go
Normal file
@ -0,0 +1,54 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.8.3
|
||||
// Source: user.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/user/internal/logic"
|
||||
"godemo/user/internal/svc"
|
||||
"godemo/user/user"
|
||||
)
|
||||
|
||||
type UserServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
user.UnimplementedUserServer
|
||||
}
|
||||
|
||||
func NewUserServer(svcCtx *svc.ServiceContext) *UserServer {
|
||||
return &UserServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 健康检查
|
||||
func (s *UserServer) Ping(ctx context.Context, in *user.PingRequest) (*user.PingResponse, error) {
|
||||
l := logic.NewPingLogic(ctx, s.svcCtx)
|
||||
return l.Ping(in)
|
||||
}
|
||||
|
||||
// 用户注册
|
||||
func (s *UserServer) Register(ctx context.Context, in *user.RegisterRequest) (*user.RegisterResponse, error) {
|
||||
l := logic.NewRegisterLogic(ctx, s.svcCtx)
|
||||
return l.Register(in)
|
||||
}
|
||||
|
||||
// 用户登录,返回 JWT Token
|
||||
func (s *UserServer) Login(ctx context.Context, in *user.LoginRequest) (*user.LoginResponse, error) {
|
||||
l := logic.NewLoginLogic(ctx, s.svcCtx)
|
||||
return l.Login(in)
|
||||
}
|
||||
|
||||
// 用户登出,可选实现
|
||||
func (s *UserServer) Logout(ctx context.Context, in *user.LogoutRequest) (*user.LogoutResponse, error) {
|
||||
l := logic.NewLogoutLogic(ctx, s.svcCtx)
|
||||
return l.Logout(in)
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
func (s *UserServer) GetUserInfo(ctx context.Context, in *user.GetUserInfoRequest) (*user.GetUserInfoResponse, error) {
|
||||
l := logic.NewGetUserInfoLogic(ctx, s.svcCtx)
|
||||
return l.GetUserInfo(in)
|
||||
}
|
||||
Reference in New Issue
Block a user