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