fix
This commit is contained in:
parent
dbffda69fd
commit
23b2eded5a
|
@ -6,7 +6,6 @@ import (
|
|||
"fusenapi/model/gmodel"
|
||||
"fusenapi/server/product-template-tag/internal/svc"
|
||||
"fusenapi/server/product-template-tag/internal/types"
|
||||
"fusenapi/service/repositories"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
|
@ -55,16 +54,17 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
productTemplateTags []gmodel.FsProductTemplateTags
|
||||
err error
|
||||
)
|
||||
//获取用户需要渲染logo
|
||||
logoInfo, err := l.svcCtx.Repositories.ImageHandle.LogoInfo(l.ctx, &repositories.LogoInfoReq{
|
||||
UserId: userinfo.UserId,
|
||||
GuestId: userinfo.GuestId,
|
||||
})
|
||||
if req.Logo == "" {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "logo is required")
|
||||
}
|
||||
logoResourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(req.Logo)
|
||||
logoInfo, err := l.svcCtx.AllModels.FsUserMaterial.FindOneByLogoResourceId(l.ctx, logoResourceId)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get logo info")
|
||||
}
|
||||
if logoInfo.Metadata == nil || *logoInfo.Metadata == "" {
|
||||
//查询logo素材信息
|
||||
if logoInfo.Metadata == nil || len(*logoInfo.Metadata) == 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "logo info`s metadata is not set")
|
||||
}
|
||||
//解析用户素材元数据
|
||||
|
@ -89,18 +89,16 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
}
|
||||
//从用户元数据获取选中的颜色数据
|
||||
mapSelectColor := make(map[string]int) //key是模板标签val是选中的索引
|
||||
if logoInfo.UserInfoMetadata != nil && *logoInfo.UserInfoMetadata != "" {
|
||||
//解析用户信息元数据
|
||||
var logoSelectInfo LogoSelect
|
||||
if err = json.Unmarshal([]byte(*logoInfo.UserInfoMetadata), &logoSelectInfo); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user info metadata")
|
||||
}
|
||||
//设置选中
|
||||
key := logoSelectInfo.LogoSelected.TemplateTagSelected.TemplateTag
|
||||
if _, ok := mapMaterialTemplateTagColors[key]; ok {
|
||||
mapSelectColor[key] = logoSelectInfo.LogoSelected.TemplateTagSelected.SelectedIndex
|
||||
}
|
||||
//解析用户信息元数据
|
||||
var logoSelectInfo LogoSelect
|
||||
if err = json.Unmarshal(*logoInfo.Metadata, &logoSelectInfo); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user info metadata")
|
||||
}
|
||||
//设置选中
|
||||
key := logoSelectInfo.LogoSelected.TemplateTagSelected.TemplateTag
|
||||
if _, ok := mapMaterialTemplateTagColors[key]; ok {
|
||||
mapSelectColor[key] = logoSelectInfo.LogoSelected.TemplateTagSelected.SelectedIndex
|
||||
}
|
||||
var templateTagNameList []string
|
||||
for templateTag, _ := range mapMaterialTemplateTagColors {
|
||||
|
|
|
@ -6,7 +6,8 @@ import (
|
|||
)
|
||||
|
||||
type GetProductTemplateTagsReq struct {
|
||||
Limit int `form:"limit"`
|
||||
Limit int `form:"limit"`
|
||||
Logo string `form:"logo"`
|
||||
}
|
||||
|
||||
type GetProductTemplateTagsRsp struct {
|
||||
|
|
|
@ -20,7 +20,8 @@ service product-template-tag {
|
|||
|
||||
//获取产品模板标签列表
|
||||
type GetProductTemplateTagsReq {
|
||||
Limit int `form:"limit"`
|
||||
Limit int `form:"limit"`
|
||||
Logo string `form:"logo"`
|
||||
}
|
||||
type GetProductTemplateTagsRsp {
|
||||
Id int64 `json:"id"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user