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

View File

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