fix:重构合图模块
This commit is contained in:
parent
09f081c1ad
commit
1af3399a9d
|
@ -61,30 +61,11 @@ type (
|
|||
)
|
||||
|
||||
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
|
||||
|
||||
// 查询logo最新基础信息
|
||||
var metadata *string
|
||||
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
|
||||
userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId)
|
||||
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
// 根据hash 查询数据资源
|
||||
var resourceId string = hash.JsonHashKey(userMaterialInfo.ResourceUrl)
|
||||
var hashKeyData = *in
|
||||
hashKeyData.GuestId = 0
|
||||
hashKeyData.UserId = 0
|
||||
var resourceId string = hash.JsonHashKey(hashKeyData)
|
||||
|
||||
resourceModel := gmodel.NewFsResourceModel(l.MysqlConn)
|
||||
resourceInfo, err := resourceModel.FindOneById(ctx, resourceId)
|
||||
|
@ -138,6 +119,27 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
|
|||
moduleDataMap["groupOptions"] = groupOptions
|
||||
moduleDataMap["materialList"] = materialList
|
||||
|
||||
// 查询logo最新基础信息
|
||||
var metadata *string
|
||||
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
|
||||
userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId)
|
||||
|
||||
if err != nil {
|
||||
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(*metadata), &combineParam)
|
||||
combineParam["template_tagid"] = in.TemplateTag
|
||||
|
|
Loading…
Reference in New Issue
Block a user