This commit is contained in:
laodaming 2023-09-11 12:24:10 +08:00
parent e6f2651704
commit 2553c6c821

View File

@ -152,24 +152,26 @@ func (w *wsConnectItem) renderImage(data []byte) {
logx.Error("failed to get element ,", err)
return
}
//获取模板开关信息并且对于没有默认值的给赋值默认值
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
}
if renderImageData.RenderData.Phone == "" {
renderImageData.RenderData.Phone = templateSwitchInfo.MaterialData.Phone.DefaultValue
}
if renderImageData.RenderData.Address == "" {
renderImageData.RenderData.Address = templateSwitchInfo.MaterialData.Address.DefaultValue
}
if renderImageData.RenderData.Qrcode == "" {
renderImageData.RenderData.Qrcode = templateSwitchInfo.MaterialData.QRcode.DefaultValue
//获取模板开关信息并且对于没有默认值的给赋值默认值(但凡DIY有一个是空的就要请求默认数据)
if renderImageData.RenderData.Website == "" || renderImageData.RenderData.Phone == "" || renderImageData.RenderData.Address == "" || renderImageData.RenderData.Qrcode == "" {
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
}
if renderImageData.RenderData.Phone == "" {
renderImageData.RenderData.Phone = templateSwitchInfo.MaterialData.Phone.DefaultValue
}
if renderImageData.RenderData.Address == "" {
renderImageData.RenderData.Address = templateSwitchInfo.MaterialData.Address.DefaultValue
}
if renderImageData.RenderData.Qrcode == "" {
renderImageData.RenderData.Qrcode = templateSwitchInfo.MaterialData.QRcode.DefaultValue
}
}
//获取刀版图
combineReq := repositories.LogoCombineReq{