fix
This commit is contained in:
parent
2e421a2968
commit
ce413c494c
|
@ -79,3 +79,7 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
|
|||
}
|
||||
return info, nil
|
||||
}
|
||||
func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int64) (resp *FsUserInfo, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ? and guest_id = ?", userId, guestId).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package logic
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/server/product-template-tag/internal/svc"
|
||||
"fusenapi/server/product-template-tag/internal/types"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -67,9 +69,18 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
if logoInfo.Metadata == nil || len(*logoInfo.Metadata) == 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "logo info`s metadata is not set")
|
||||
}
|
||||
//获取userInfo信息
|
||||
userProfile, err := l.svcCtx.AllModels.FsUserInfo.FindOneByUser(l.ctx, userinfo.UserId, userinfo.GuestId)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "user profile info is not found")
|
||||
}
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get user profile info")
|
||||
}
|
||||
//解析用户素材元数据
|
||||
var metaData map[string]interface{}
|
||||
if err = json.Unmarshal([]byte(*logoInfo.Metadata), &metaData); err != nil {
|
||||
if err = json.Unmarshal(*logoInfo.Metadata, &metaData); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user metadata")
|
||||
}
|
||||
|
@ -91,7 +102,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
mapSelectColor := make(map[string]int) //key是模板标签val是选中的索引
|
||||
//解析用户信息元数据
|
||||
var logoSelectInfo LogoSelect
|
||||
if err = json.Unmarshal(*logoInfo.Metadata, &logoSelectInfo); err != nil {
|
||||
if err = json.Unmarshal(*userProfile.Metadata, &logoSelectInfo); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user info metadata")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user