From d98622896431f4d0bedf58f3fa2435f47a65ed6c Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 23 Nov 2023 15:04:17 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/ws_render_image.go | 14 +++++++++----- utils/template_switch_info/template_switch.go | 10 ---------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 195bc86d..24aae79e 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -223,14 +223,18 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe } //qrcode不需要依赖合图组开关 if switchInfo.SwitchInfo.QRcode.IfShow && switchInfo.SwitchInfo.QRcode.UserDisabled { - combineReq.Qrcode = &switchInfo.SwitchInfo.QRcode.DefaultValue + if renderImageData.RenderData.Qrcode == "" { + combineReq.Qrcode = &switchInfo.SwitchInfo.QRcode.Text + } else { + combineReq.Qrcode = &renderImageData.RenderData.Qrcode + } } //合图组开关开启 if switchInfo.CombineIsVisible { //开启slogan if switchInfo.SwitchInfo.Slogan.IfShow && switchInfo.SwitchInfo.Slogan.UserDisabled { if renderImageData.RenderData.Slogan == "" { - combineReq.Slogan = &switchInfo.SwitchInfo.Slogan.DefaultValue + combineReq.Slogan = &switchInfo.SwitchInfo.Slogan.Text } else { combineReq.Slogan = &renderImageData.RenderData.Slogan } @@ -238,7 +242,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe //开启website if switchInfo.SwitchInfo.Website.IfShow && switchInfo.SwitchInfo.Website.UserDisabled { if renderImageData.RenderData.Website == "" { - combineReq.Website = &switchInfo.SwitchInfo.Website.DefaultValue + combineReq.Website = &switchInfo.SwitchInfo.Website.Text } else { combineReq.Website = &renderImageData.RenderData.Website } @@ -246,7 +250,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe //开启address if switchInfo.SwitchInfo.Address.IfShow && switchInfo.SwitchInfo.Address.UserDisabled { if renderImageData.RenderData.Address == "" { - combineReq.Address = &switchInfo.SwitchInfo.Address.DefaultValue + combineReq.Address = &switchInfo.SwitchInfo.Address.Text } else { combineReq.Address = &renderImageData.RenderData.Address } @@ -254,7 +258,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe //开启Phone if switchInfo.SwitchInfo.Phone.IfShow && switchInfo.SwitchInfo.Phone.UserDisabled { if renderImageData.RenderData.Phone == "" { - combineReq.Phone = &switchInfo.SwitchInfo.Phone.DefaultValue + combineReq.Phone = &switchInfo.SwitchInfo.Phone.Text } else { combineReq.Phone = &renderImageData.RenderData.Phone } diff --git a/utils/template_switch_info/template_switch.go b/utils/template_switch_info/template_switch.go index d1d3f46f..785d5ca0 100644 --- a/utils/template_switch_info/template_switch.go +++ b/utils/template_switch_info/template_switch.go @@ -23,31 +23,26 @@ type QRcode struct { IfShow bool `json:"if_show"` UserDisabled bool `json:"user_disabled"` Text string `json:"text"` - DefaultValue string `json:"default_value"` } type Website struct { IfShow bool `json:"if_show"` UserDisabled bool `json:"user_disabled"` Text string `json:"text"` - DefaultValue string `json:"default_value"` } type Address struct { IfShow bool `json:"if_show"` UserDisabled bool `json:"user_disabled"` Text string `json:"text"` - DefaultValue string `json:"default_value"` } type Slogan struct { IfShow bool `json:"if_show"` UserDisabled bool `json:"user_disabled"` Text string `json:"text"` - DefaultValue string `json:"default_value"` } type Phone struct { IfShow bool `json:"if_show"` UserDisabled bool `json:"user_disabled"` Text string `json:"text"` - DefaultValue string `json:"default_value"` } type Logo struct { Material string `json:"material"` @@ -72,23 +67,18 @@ func GetTemplateSwitchInfo(templateId int64, templateJsonStr *string, templateMa 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",