This commit is contained in:
laodaming
2023-09-11 12:17:07 +08:00
parent 00be036e59
commit ac11753274
3 changed files with 76 additions and 30 deletions

View File

@@ -105,14 +105,13 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, fmt.Sprintf("failed to parse json product template info(may be old data):%d", templateInfo.Id))
}
//后台隐藏/显示信息(现在下面是写死了)
/*var switchInfo interface{}
if templateInfo.SwitchInfo != nil && *templateInfo.SwitchInfo != "" {
_ = json.Unmarshal([]byte(*templateInfo.SwitchInfo), &switchInfo)
}*/
modelInfo := modelList[modelIndex]
mapKey := fmt.Sprintf("_%d", *modelInfo.SizeId)
rsp[mapKey] = template_switch_info.GetTemplateSwitchInfo(templateInfo.Id, *templateInfo.MaterialImg)
switchInfo, err := template_switch_info.GetTemplateSwitchInfo(templateInfo.Id, templateInfo.TemplateInfo, *templateInfo.MaterialImg)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error())
}
rsp[mapKey] = switchInfo
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", rsp)
}

View File

@@ -153,7 +153,12 @@ func (w *wsConnectItem) renderImage(data []byte) {
return
}
//获取模板开关信息并且对于没有默认值的给赋值默认值
templateSwitchInfo := template_switch_info.GetTemplateSwitchInfo(productTemplate.Id, *productTemplate.MaterialImg)
templateSwitchInfo, err := template_switch_info.GetTemplateSwitchInfo(productTemplate.Id, productTemplate.TemplateInfo, *productTemplate.MaterialImg)
if err != nil {
logx.Error(err)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", err.Error(), renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
return
}
if renderImageData.RenderData.Website == "" {
renderImageData.RenderData.Website = templateSwitchInfo.MaterialData.Website.DefaultValue
}