fix:重构合图模块

This commit is contained in:
Hiven 2023-08-15 14:51:54 +08:00
parent 3ce253b1e5
commit 98b0765363

View File

@ -117,16 +117,28 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
moduleDataMap["materialList"] = materialList
// 查询logo最新基础信息
var metadata *string
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId)
if err != nil {
logx.Error(err)
return nil, err
if errors.Is(err, gorm.ErrRecordNotFound) {
userMaterialInfoDefault, err := userMaterialModel.FindOneById(ctx, 0)
if err != nil {
logx.Error(err)
return nil, err
}
metadata = userMaterialInfoDefault.Metadata
} else {
logx.Error(err)
return nil, err
}
} else {
metadata = userMaterialInfo.Metadata
}
var combineParam map[string]interface{}
json.Unmarshal([]byte(*userMaterialInfo.Metadata), &combineParam)
json.Unmarshal([]byte(*metadata), &combineParam)
combineParam["template_tagid"] = in.TemplateTag
combineParam["website"] = in.Website
combineParam["slogan"] = in.Slogan