fix:upload设置
This commit is contained in:
parent
6d8401d3e0
commit
ace57c52f4
|
@ -2,7 +2,9 @@ package logic
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/service/repositories"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
|
@ -65,6 +67,27 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
|
|||
}
|
||||
return resp.SetStatus(basic.CodeApiErr)
|
||||
}
|
||||
|
||||
var userMaterialMetadata []byte
|
||||
if logoData.Metadata == nil {
|
||||
var resultStr string
|
||||
resLogoStandard, err := l.svcCtx.Repositories.ImageHandle.LogoInfoSet(l.ctx, &repositories.LogoInfoSetReq{
|
||||
LogoUrl: *logoData.ResourceUrl,
|
||||
Version: l.svcCtx.Config.BLMService.Version,
|
||||
Debug: userinfo.Debug,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
basic.CodeServiceErr.Message = fmt.Sprintf("算法请求--LOGO信息--错误:%+v", err)
|
||||
return resp.SetStatus(basic.CodeServiceErr, fmt.Sprintf("算法请求--LOGO信息--错误:%+v", err))
|
||||
}
|
||||
resultStr = resLogoStandard.Res
|
||||
userMaterialMetadata = []byte(resultStr)
|
||||
} else {
|
||||
userMaterialMetadata = *logoData.Metadata
|
||||
}
|
||||
|
||||
// 新增素材
|
||||
var module = "logo"
|
||||
var nowTime = time.Now().UTC()
|
||||
|
@ -76,7 +99,7 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
|
|||
GuestId: &guestId,
|
||||
ResourceId: &resourceId,
|
||||
ResourceUrl: logoData.ResourceUrl,
|
||||
Metadata: logoData.Metadata,
|
||||
Metadata: &userMaterialMetadata,
|
||||
Ctime: &nowTime,
|
||||
}
|
||||
resCreate := l.svcCtx.MysqlConn.Create(&materialInfo)
|
||||
|
|
|
@ -106,6 +106,7 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
|
|||
return err
|
||||
}
|
||||
}
|
||||
var logoCategoryId int64
|
||||
// 更新merchant_category
|
||||
if req.SetLogoCategory == 1 {
|
||||
var metadataChildUserMaterial = make(map[string]interface{}, 1)
|
||||
|
@ -129,7 +130,7 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
logoCategoryId = req.CategoryId
|
||||
}
|
||||
var module = "profile"
|
||||
if req.SetLogoSelected == 1 {
|
||||
|
@ -182,11 +183,16 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
|
|||
templateTagSelected["template_tag"] = userMaterialTemplateIdTagId
|
||||
templateTagSelected["selected_index"] = 0
|
||||
|
||||
metadataChildUserInfo["logo_selected"] = map[string]interface{}{
|
||||
var logoSelectedMap = map[string]interface{}{
|
||||
"logo_selected_id": req.LogoSelectedId,
|
||||
"logo_url": userMaterialInfo.ResourceUrl,
|
||||
"template_tag_selected": templateTagSelected,
|
||||
}
|
||||
if logoCategoryId != 0 {
|
||||
logoSelectedMap["merchant_category"] = logoCategoryId
|
||||
}
|
||||
|
||||
metadataChildUserInfo["logo_selected"] = logoSelectedMap
|
||||
|
||||
metadataMapUserInfo, err := metadata.SetMetadata(metadataChildUserInfo, metadataMapOldUserInfo)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user