47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"fusenapi/home-user-auth/internal/svc"
|
|
"fusenapi/home-user-auth/internal/types"
|
|
"fusenapi/model"
|
|
"fusenapi/utils/basic"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type UserSaveBasicInfoLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewUserSaveBasicInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserSaveBasicInfoLogic {
|
|
return &UserSaveBasicInfoLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *UserSaveBasicInfoLogic) UserSaveBasicInfo(req *types.RequestBasicInfoForm) (resp *types.Response) {
|
|
// 必须返回response, 前端需要的是内部约定的Code码, 处理相关的逻辑. 例子(eg): resp.Set(501, "error")
|
|
resp = &types.Response{}
|
|
// logx.Info(req)
|
|
// if userinfo.UserId == 0 {
|
|
// resp.SetStatusWithMessage(basic.DefaultError, "user is not exists")
|
|
// return resp
|
|
// }
|
|
|
|
userid := l.ctx.Value("userid").(int64)
|
|
|
|
fsUserModel, err := model.NewFsUserModel(l.svcCtx.MysqlConn).FindOne(l.ctx, userid)
|
|
if err != nil {
|
|
logx.Error(err)
|
|
}
|
|
|
|
resp.SetStatus(basic.StatusOK, fsUserModel)
|
|
return resp
|
|
}
|