From 2553c6c82112214b731f477c6ec26e5882a07cb4 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 11 Sep 2023 12:24:10 +0800 Subject: [PATCH] fix --- .../internal/logic/ws_render_image.go | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 81e895f2..524d766c 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -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{