This commit is contained in:
laodaming 2023-11-23 12:24:12 +08:00
parent f18e1760a2
commit 9b60897a2a
2 changed files with 35 additions and 37 deletions

View File

@ -225,13 +225,13 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
Debug: w.debug, Debug: w.debug,
} }
//qrcode不需要依赖合图组开关 //qrcode不需要依赖合图组开关
if switchInfo.SwitchInfo.QRcode.IfShow { if switchInfo.SwitchInfo.QRcode.IfShow && switchInfo.SwitchInfo.QRcode.UserDisabled {
combineReq.Qrcode = &switchInfo.SwitchInfo.QRcode.DefaultValue combineReq.Qrcode = &switchInfo.SwitchInfo.QRcode.DefaultValue
} }
//合图组开关开启 //合图组开关开启
if switchInfo.CombineIsVisible { if switchInfo.CombineIsVisible {
//开启slogan //开启slogan
if switchInfo.SwitchInfo.Slogan.IfShow { if switchInfo.SwitchInfo.Slogan.IfShow && switchInfo.SwitchInfo.Slogan.UserDisabled {
if renderImageData.RenderData.Slogan == "" { if renderImageData.RenderData.Slogan == "" {
combineReq.Slogan = &switchInfo.SwitchInfo.Slogan.DefaultValue combineReq.Slogan = &switchInfo.SwitchInfo.Slogan.DefaultValue
} else { } else {
@ -239,7 +239,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
} }
} }
//开启website //开启website
if switchInfo.SwitchInfo.Website.IfShow { if switchInfo.SwitchInfo.Website.IfShow && switchInfo.SwitchInfo.Website.UserDisabled {
if renderImageData.RenderData.Website == "" { if renderImageData.RenderData.Website == "" {
combineReq.Website = &switchInfo.SwitchInfo.Website.DefaultValue combineReq.Website = &switchInfo.SwitchInfo.Website.DefaultValue
} else { } else {
@ -247,7 +247,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
} }
} }
//开启address //开启address
if switchInfo.SwitchInfo.Address.IfShow { if switchInfo.SwitchInfo.Address.IfShow && switchInfo.SwitchInfo.Address.UserDisabled {
if renderImageData.RenderData.Address == "" { if renderImageData.RenderData.Address == "" {
combineReq.Address = &switchInfo.SwitchInfo.Address.DefaultValue combineReq.Address = &switchInfo.SwitchInfo.Address.DefaultValue
} else { } else {
@ -255,7 +255,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
} }
} }
//开启Phone //开启Phone
if switchInfo.SwitchInfo.Phone.IfShow { if switchInfo.SwitchInfo.Phone.IfShow && switchInfo.SwitchInfo.Phone.UserDisabled {
if renderImageData.RenderData.Phone == "" { if renderImageData.RenderData.Phone == "" {
combineReq.Phone = &switchInfo.SwitchInfo.Phone.DefaultValue combineReq.Phone = &switchInfo.SwitchInfo.Phone.DefaultValue
} else { } else {

View File

@ -70,19 +70,32 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa
Id: templateId, Id: templateId,
Material: templateMaterialImg, Material: templateMaterialImg,
SwitchInfo: SwitchInfo{ SwitchInfo: SwitchInfo{
QRcode: QRcode{
UserDisabled: true,
DefaultValue: "your qrcode",
},
Website: Website{
UserDisabled: true,
DefaultValue: "your website",
},
Address: Address{
UserDisabled: true,
DefaultValue: "your address",
},
Phone: Phone{
UserDisabled: true,
DefaultValue: "your phone",
},
Slogan: Slogan{
UserDisabled: true,
DefaultValue: "your slogan",
},
Logo: Logo{ Logo: Logo{
Material: "/image/logo/aHnT1_rzubdwax_scale.png", Material: "/image/logo/aHnT1_rzubdwax_scale.png",
}, },
}, },
CombineIsVisible: false, CombineIsVisible: false,
} }
defer func() {
returnData.SwitchInfo.QRcode.UserDisabled = true
returnData.SwitchInfo.Website.UserDisabled = true
returnData.SwitchInfo.Address.UserDisabled = true
returnData.SwitchInfo.Phone.UserDisabled = true
returnData.SwitchInfo.Slogan.UserDisabled = true
}()
if templateJsonStr == nil || *templateJsonStr == "" { if templateJsonStr == nil || *templateJsonStr == "" {
return returnData return returnData
} }
@ -98,35 +111,20 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa
} }
switch v.Tag { switch v.Tag {
case "Phone": //电话 case "Phone": //电话
returnData.SwitchInfo.Phone = Phone{ returnData.SwitchInfo.Phone.IfShow = v.Visible
IfShow: v.Visible, returnData.SwitchInfo.Phone.Text = v.Text
Text: v.Text,
DefaultValue: "your phone",
}
case "Address": //地址 case "Address": //地址
returnData.SwitchInfo.Address = Address{ returnData.SwitchInfo.Address.IfShow = v.Visible
IfShow: v.Visible, returnData.SwitchInfo.Address.Text = v.Text
Text: v.Text,
DefaultValue: "your address",
}
case "Website": case "Website":
returnData.SwitchInfo.Website = Website{ returnData.SwitchInfo.Website.IfShow = v.Visible
IfShow: v.Visible, returnData.SwitchInfo.Website.Text = v.Text
Text: v.Text,
DefaultValue: "your website",
}
case "QRcode": case "QRcode":
returnData.SwitchInfo.QRcode = QRcode{ returnData.SwitchInfo.QRcode.IfShow = v.Visible
IfShow: v.Visible, returnData.SwitchInfo.QRcode.Text = v.Text
Text: v.Text,
DefaultValue: "your qrcode content",
}
case "Slogan": case "Slogan":
returnData.SwitchInfo.Slogan = Slogan{ returnData.SwitchInfo.Slogan.IfShow = v.Visible
IfShow: v.Visible, returnData.SwitchInfo.Slogan.Text = v.Text
Text: v.Text,
DefaultValue: "your slogan",
}
} }
} }
return returnData return returnData