temp
This commit is contained in:
41
apps/user/internal/logic/user/getuserinfologic.go
Normal file
41
apps/user/internal/logic/user/getuserinfologic.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package userlogic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"tianyuan-api/apps/user/internal/svc"
|
||||
"tianyuan-api/apps/user/user"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetUserInfoLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
|
||||
return &GetUserInfoLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetUserInfoLogic) GetUserInfo(in *user.UserInfoReq) (*user.GetUserInfoResp, error) {
|
||||
// 查询用户信息
|
||||
users, err := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId)
|
||||
if err != nil {
|
||||
return nil, errors.New("用户不存在")
|
||||
}
|
||||
|
||||
// 正常返回用户和企业信息
|
||||
return &user.GetUserInfoResp{
|
||||
Username: users.Username,
|
||||
Phone: users.Phone,
|
||||
Disable: users.Disable,
|
||||
QuotaExceeded: users.QuotaExceeded,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user