Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
95d9c628d7
|
@ -8,7 +8,6 @@ import (
|
|||
"fmt"
|
||||
"fusenapi/utils/fssql"
|
||||
"fusenapi/utils/handlers"
|
||||
"log"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
@ -101,7 +100,7 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
|
|||
if !ok {
|
||||
return m.getDefaultProfile(ctx, tname)
|
||||
}
|
||||
log.Println(v, guestId, userId)
|
||||
|
||||
var info map[string]any
|
||||
err = json.Unmarshal([]byte(v), &info)
|
||||
if err != nil {
|
||||
|
|
|
@ -39,8 +39,8 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa
|
|||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
|
||||
if len(req.NewPassword) > 30 {
|
||||
return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 30")
|
||||
if len(req.NewPassword) > 64 {
|
||||
return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 64")
|
||||
}
|
||||
|
||||
rt, err := l.svcCtx.ResetTokenManger.Decrypt(req.ResetToken) // ResetToken
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
|
@ -21,8 +20,6 @@ func UserGetProfileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
log.Println(userinfo)
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewUserGetProfileLogic(r.Context(), svcCtx)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package logic
|
|||
import (
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"log"
|
||||
|
||||
"context"
|
||||
|
||||
|
@ -35,12 +34,21 @@ func (l *UserGetProfileLogic) UserGetProfile(req *types.QueryProfileRequest, use
|
|||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
|
||||
log.Println(userinfo)
|
||||
profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId, userinfo.GuestId)
|
||||
if err != nil {
|
||||
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
|
||||
}
|
||||
|
||||
user, err := l.svcCtx.AllModels.FsUser.FindUserById(context.TODO(), userinfo.UserId)
|
||||
if err != nil {
|
||||
logx.Error(err) // 日志记录错误
|
||||
return resp.SetStatus(basic.CodeDbSqlErr, err) // 返回数据库创建错误
|
||||
}
|
||||
|
||||
if bmap, ok := profileBase["base"].(map[string]any); ok {
|
||||
bmap["email"] = *user.Email
|
||||
}
|
||||
|
||||
return resp.SetStatus(basic.CodeOK, profileBase)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user