This commit is contained in:
laodaming 2023-09-12 17:59:07 +08:00
parent 6e42d9d218
commit df73e8d5ce
3 changed files with 3 additions and 16 deletions

View File

@ -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)
}

View File

@ -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.GetTemplateSwitchInfoerr%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
}

View File

@ -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
}