package logic import ( "context" "fusenapi/utils/auth" "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) { loginInfo := auth.GetUserInfoFormCtx(l.ctx) if loginInfo.UserId == 0 { return resp.SetStatus(basic.CodeOK, "parse login info err ") } fsUserModel, err := model.NewFsUserModel(l.svcCtx.MysqlConn).FindOne(l.ctx, loginInfo.UserId) if err != nil { if err == model.ErrNotFound { return resp } logx.Error(err) return resp } return resp.SetStatus(basic.CodeOK, fsUserModel) }