This commit is contained in:
laodaming 2023-06-13 19:11:30 +08:00
parent d523d62abd
commit ea60e5c07c

View File

@ -26,15 +26,15 @@ func NewGetSuccessRecommandLogic(ctx context.Context, svcCtx *svc.ServiceContext
}
// 获取推荐的产品列表
func (l *GetSuccessRecommandLogic) GetSuccessRecommand(req *types.GetSuccessRecommandReq, loginInfo *auth.UserInfo) (resp *basic.Response) {
func (l *GetSuccessRecommandLogic) GetSuccessRecommand(req *types.GetSuccessRecommandReq, userInfo *auth.UserInfo) (resp *basic.Response) {
//获取用户信息
userModel := gmodel.NewFsUserModel(l.svcCtx.MysqlConn)
userInfo, err := userModel.FindOne(l.ctx, loginInfo.UserId)
user, err := userModel.FindOne(l.ctx, userInfo.UserId)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get user info")
}
if userInfo.Id == 0 {
if user.Id == 0 {
return resp.SetStatusWithMessage(basic.CodeUnAuth, "failed to get user info")
}
if req.Num == 0 || req.Num > 500 {
@ -65,12 +65,12 @@ func (l *GetSuccessRecommandLogic) GetSuccessRecommand(req *types.GetSuccessReco
//千人千面处理
thousandFaceImageFormatReq := image.ThousandFaceImageFormatReq{
Size: int(req.Size),
IsThousandFace: int(userInfo.IsThousandFace),
IsThousandFace: int(user.IsThousandFace),
Cover: *v.Cover,
CoverImg: *v.CoverImg,
CoverDefault: *v.CoverImg,
ProductId: v.Id,
UserInfo: userInfo,
UserInfo: user,
}
image.ThousandFaceImageFormat(&thousandFaceImageFormatReq)
data.Cover = thousandFaceImageFormatReq.Cover