This commit is contained in:
laodaming 2023-10-27 10:57:48 +08:00
parent 5b4ea9995b
commit 344eeebecb

View File

@ -8,10 +8,10 @@ import (
type GetTemplateSwitchInfoRsp struct { type GetTemplateSwitchInfoRsp struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Material string `json:"material"` Material string `json:"material"`
MaterialData MaterialData `json:"material_data"` SwitchInfo SwitchInfo `json:"switch_info"`
CombineIsVisible bool `json:"combine_is_visible"` //合图总开关是否开启 CombineIsVisible bool `json:"combine_is_visible"` //合图总开关是否开启
} }
type MaterialData struct { type SwitchInfo struct {
QRcode QRcode `json:"QRcode"` QRcode QRcode `json:"QRcode"`
Website Website `json:"Website"` Website Website `json:"Website"`
Address Address `json:"Address"` Address Address `json:"Address"`
@ -64,7 +64,7 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa
returnData := GetTemplateSwitchInfoRsp{ returnData := GetTemplateSwitchInfoRsp{
Id: templateId, Id: templateId,
Material: templateMaterialImg, Material: templateMaterialImg,
MaterialData: MaterialData{ SwitchInfo: SwitchInfo{
Logo: Logo{ Logo: Logo{
Material: "/image/logo/aHnT1_rzubdwax_scale.png", Material: "/image/logo/aHnT1_rzubdwax_scale.png",
}, },
@ -84,7 +84,7 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa
return GetTemplateSwitchInfoRsp{ return GetTemplateSwitchInfoRsp{
Id: templateId, Id: templateId,
Material: templateMaterialImg, Material: templateMaterialImg,
MaterialData: MaterialData{ SwitchInfo: SwitchInfo{
Logo: Logo{ Logo: Logo{
Material: "/image/logo/aHnT1_rzubdwax_scale.png", Material: "/image/logo/aHnT1_rzubdwax_scale.png",
}, },
@ -94,31 +94,31 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa
} }
switch v.Tag { switch v.Tag {
case "Phone": //电话 case "Phone": //电话
returnData.MaterialData.Phone = Phone{ returnData.SwitchInfo.Phone = Phone{
IfShow: v.Visible, IfShow: v.Visible,
Text: v.Text, Text: v.Text,
DefaultValue: "your phone", DefaultValue: "your phone",
} }
case "Address": //地址 case "Address": //地址
returnData.MaterialData.Address = Address{ returnData.SwitchInfo.Address = Address{
IfShow: v.Visible, IfShow: v.Visible,
Text: v.Text, Text: v.Text,
DefaultValue: "your address", DefaultValue: "your address",
} }
case "Website": case "Website":
returnData.MaterialData.Website = Website{ returnData.SwitchInfo.Website = Website{
IfShow: v.Visible, IfShow: v.Visible,
Text: v.Text, Text: v.Text,
DefaultValue: "your website", DefaultValue: "your website",
} }
case "QRcode": case "QRcode":
returnData.MaterialData.QRcode = QRcode{ returnData.SwitchInfo.QRcode = QRcode{
IfShow: v.Visible, IfShow: v.Visible,
Text: v.Text, Text: v.Text,
DefaultValue: "your qrcode content", DefaultValue: "your qrcode content",
} }
case "Slogan": case "Slogan":
returnData.MaterialData.Slogan = Slogan{ returnData.SwitchInfo.Slogan = Slogan{
IfShow: v.Visible, IfShow: v.Visible,
Text: v.Text, Text: v.Text,
DefaultValue: "your slogan", DefaultValue: "your slogan",