From 813e315ae3cc6b5465ef57fb9a18fd9699980ff3 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 27 Oct 2023 11:24:41 +0800 Subject: [PATCH] fix --- utils/template_switch_info/template_switch.go | 39 +++++-------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/utils/template_switch_info/template_switch.go b/utils/template_switch_info/template_switch.go index 9e639aa8..ff19eb14 100644 --- a/utils/template_switch_info/template_switch.go +++ b/utils/template_switch_info/template_switch.go @@ -70,27 +70,19 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa Id: templateId, Material: templateMaterialImg, MaterialData: MaterialData{ - QRcode: QRcode{ - UserDisabled: true, - }, - Website: Website{ - UserDisabled: true, - }, - Address: Address{ - UserDisabled: true, - }, - Phone: Phone{ - UserDisabled: true, - }, - Slogan: Slogan{ - UserDisabled: true, - }, Logo: Logo{ Material: "/image/logo/aHnT1_rzubdwax_scale.png", }, }, CombineIsVisible: false, } + defer func() { + returnData.MaterialData.QRcode.UserDisabled = true + returnData.MaterialData.Website.UserDisabled = true + returnData.MaterialData.Address.UserDisabled = true + returnData.MaterialData.Phone.UserDisabled = true + returnData.MaterialData.Slogan.UserDisabled = true + }() if templateJsonStr == nil || *templateJsonStr == "" { return returnData } @@ -101,16 +93,8 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa } for _, v := range templateJsonInfo.MaterialList { if v.Type == "combine" { - return GetTemplateSwitchInfoRsp{ - Id: templateId, - Material: templateMaterialImg, - MaterialData: MaterialData{ - Logo: Logo{ - Material: "/image/logo/aHnT1_rzubdwax_scale.png", - }, - }, - CombineIsVisible: v.Visible, - } + returnData.CombineIsVisible = v.Visible + continue } switch v.Tag { case "Phone": //电话 @@ -118,35 +102,30 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa IfShow: v.Visible, Text: v.Text, DefaultValue: "your phone", - UserDisabled: true, } case "Address": //地址 returnData.MaterialData.Address = Address{ IfShow: v.Visible, Text: v.Text, DefaultValue: "your address", - UserDisabled: true, } case "Website": returnData.MaterialData.Website = Website{ IfShow: v.Visible, Text: v.Text, DefaultValue: "your website", - UserDisabled: true, } case "QRcode": returnData.MaterialData.QRcode = QRcode{ IfShow: v.Visible, Text: v.Text, DefaultValue: "your qrcode content", - UserDisabled: true, } case "Slogan": returnData.MaterialData.Slogan = Slogan{ IfShow: v.Visible, Text: v.Text, DefaultValue: "your slogan", - UserDisabled: true, } } }