fix
This commit is contained in:
parent
13c6eea1a8
commit
357f402031
|
@ -175,13 +175,13 @@ func getCombineImage(ctx context.Context, svcCtx *svc.ServiceContext, parseInfo
|
|||
return "", errors.New("product template info`template_info is empty")
|
||||
}
|
||||
//反序列化替换其中一些参数
|
||||
var combineInfo map[string]interface{}
|
||||
if err = json.Unmarshal([]byte(*productTemplate.TemplateInfo), &combineInfo); err != nil {
|
||||
var moduleInfo interface{}
|
||||
if err = json.Unmarshal([]byte(*productTemplate.TemplateInfo), &moduleInfo); err != nil {
|
||||
logx.Error("failed to parse json:template_info:", err)
|
||||
return "", err
|
||||
}
|
||||
//需要替换的参数
|
||||
replaceData := map[string]interface{}{
|
||||
paramData := map[string]interface{}{
|
||||
"logo_url": parseInfo.RenderData.Logo,
|
||||
"website": parseInfo.RenderData.Website,
|
||||
"slogan": parseInfo.RenderData.Slogan,
|
||||
|
@ -214,17 +214,20 @@ func getCombineImage(ctx context.Context, svcCtx *svc.ServiceContext, parseInfo
|
|||
return "", err
|
||||
}
|
||||
//赋值
|
||||
replaceData["colors"] = materialMetaData["colors"]
|
||||
replaceData["logo_url"] = materialMetaData["logo_url"]
|
||||
replaceData["shape"] = materialMetaData["shape"]
|
||||
replaceData["is_crop"] = materialMetaData["is_crop"]
|
||||
replaceData["ratio"] = materialMetaData["ratio"]
|
||||
replaceData["line"] = materialMetaData["line"]
|
||||
replaceData["other"] = materialMetaData["other"]
|
||||
replaceData["other1"] = materialMetaData["other1"]
|
||||
paramData["colors"] = materialMetaData["colors"]
|
||||
paramData["logo_url"] = materialMetaData["logo_url"]
|
||||
paramData["shape"] = materialMetaData["shape"]
|
||||
paramData["is_crop"] = materialMetaData["is_crop"]
|
||||
paramData["ratio"] = materialMetaData["ratio"]
|
||||
paramData["line"] = materialMetaData["line"]
|
||||
paramData["other"] = materialMetaData["other"]
|
||||
paramData["other1"] = materialMetaData["other1"]
|
||||
}
|
||||
}
|
||||
combineInfo["param_data"] = replaceData
|
||||
combineInfo := map[string]interface{}{
|
||||
"module_data": moduleInfo,
|
||||
"param_data": paramData,
|
||||
}
|
||||
postData, _ := json.Marshal(combineInfo)
|
||||
//请求合成图片
|
||||
url := svcCtx.Config.PythonApi.CombineImageUrl
|
||||
|
|
Loading…
Reference in New Issue
Block a user