package logic import ( "context" "fusenapi/utils/auth" "fusenapi/model" "fusenapi/server/home-user-auth/internal/svc" "fusenapi/server/home-user-auth/internal/types" "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, userinfo *auth.UserInfo) (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) }