From df73e8d5ce4a5c918f27416386ea943c3e618f6a Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 12 Sep 2023 17:59:07 +0800 Subject: [PATCH] 11 --- server/product/internal/logic/gettemplatebypidlogic.go | 6 +----- server/resource/internal/logic/logocombinelogic.go | 6 +----- server/websocket/internal/logic/ws_render_image.go | 7 +------ 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/server/product/internal/logic/gettemplatebypidlogic.go b/server/product/internal/logic/gettemplatebypidlogic.go index 6a2c654f..ff89875f 100644 --- a/server/product/internal/logic/gettemplatebypidlogic.go +++ b/server/product/internal/logic/gettemplatebypidlogic.go @@ -104,11 +104,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq, } modelInfo := modelList[modelIndex] mapKey := fmt.Sprintf("_%d", *modelInfo.SizeId) - 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 + rsp[mapKey] = template_switch_info.GetTemplateSwitchInfo(templateInfo.Id, templateInfo.TemplateInfo, *templateInfo.MaterialImg) } return resp.SetStatusWithMessage(basic.CodeOK, "success", rsp) } diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index 5706bb75..dcfd7e63 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -74,11 +74,7 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth logc.Errorf(l.ctx, "productTemplateV2Model.FindOne:%v", err) return resp.SetStatus(basic.CodeServiceErr, "模版不存在") } - templateSwitchInfo, err := template_switch_info.GetTemplateSwitchInfo(req.TemplateId, productTemplateV2Info.TemplateInfo, *productTemplateV2Info.MaterialImg) - if err != nil { - logc.Errorf(l.ctx, "template_switch_info.GetTemplateSwitchInfo,err:%v", err) - return resp.SetStatus(basic.CodeServiceErr, "默认模版不存在") - } + templateSwitchInfo := template_switch_info.GetTemplateSwitchInfo(req.TemplateId, productTemplateV2Info.TemplateInfo, *productTemplateV2Info.MaterialImg) if req.Address == "" && templateSwitchInfo.MaterialData.Address.IfShow { req.Address = templateSwitchInfo.MaterialData.Address.DefaultValue } diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 1afe255d..04633d3f 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -163,12 +163,7 @@ func (w *wsConnectItem) renderImage(data []byte) { } //获取模板开关信息并且对于没有默认值的给赋值默认值(但凡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 - } + templateSwitchInfo := template_switch_info.GetTemplateSwitchInfo(productTemplate.Id, productTemplate.TemplateInfo, *productTemplate.MaterialImg) if renderImageData.RenderData.Website == "" && templateSwitchInfo.MaterialData.Website.IfShow { renderImageData.RenderData.Website = templateSwitchInfo.MaterialData.Website.DefaultValue }