From ab153ea15b5a519b6fdcea94904f38d9ac70a213 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Wed, 22 Nov 2023 15:01:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=88=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/internal/types/types.go | 10 +++--- .../internal/logic/ws_render_image.go | 19 +++++------ server_api/resource.api | 10 +++--- service/repositories/image_handle.go | 32 +++++++++++++------ 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/server/resource/internal/types/types.go b/server/resource/internal/types/types.go index 199742bd..d7d8b473 100644 --- a/server/resource/internal/types/types.go +++ b/server/resource/internal/types/types.go @@ -38,11 +38,11 @@ type LogoCombineReq struct { TemplateTagGroups []TemplateTagGroups `json:"template_tag_groups"` TemplateId int64 `json:"template_id"` // 合图参数 TemplateTag string `json:"template_tag"` // 合图参数 - Website string `json:"website,optional"` // 合图参数 - Slogan string `json:"slogan,optional"` // 合图参数 - Address string `json:"address,optional"` // 合图参数 - Phone string `json:"phone,optional"` // 合图参数 - Qrcode string `json:"qrcode,optional"` // 合图参数 + Website *string `json:"website,optional"` // 合图参数 + Slogan *string `json:"slogan,optional"` // 合图参数 + Address *string `json:"address,optional"` // 合图参数 + Phone *string `json:"phone,optional"` // 合图参数 + Qrcode *string `json:"qrcode,optional"` // 合图参数 } type TemplateTagColor struct { diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index ec492f24..baca87ff 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -12,10 +12,11 @@ import ( "fusenapi/utils/curl" "fusenapi/utils/hash" "fusenapi/utils/websocket_data" - "github.com/zeromicro/go-zero/core/logx" - "gorm.io/gorm" "strconv" "time" + + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" ) var ( @@ -214,12 +215,12 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe ProductTemplateV2Info: productTemplate, ProductTemplateTagGroups: renderImageData.RenderData.TemplateTagGroups, TemplateTag: renderImageData.RenderData.TemplateTag, - Website: renderImageData.RenderData.Website, - Slogan: renderImageData.RenderData.Slogan, - Address: renderImageData.RenderData.Address, - Phone: renderImageData.RenderData.Phone, - Qrcode: renderImageData.RenderData.Qrcode, - LogoUrl: renderImageData.RenderData.Logo, + // Website: &renderImageData.RenderData.Website, + // Slogan: &renderImageData.RenderData.Slogan, + // Address: &renderImageData.RenderData.Address, + // Phone: &renderImageData.RenderData.Phone, + // Qrcode: &renderImageData.RenderData.Qrcode, + LogoUrl: renderImageData.RenderData.Logo, TemplateTagColor: repositories.TemplateTagColor{ Color: renderImageData.RenderData.TemplateTagColor.Colors, Index: renderImageData.RenderData.TemplateTagColor.SelectedColorIndex, @@ -273,7 +274,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe RenderProcessTime: &websocket_data.RenderProcessTime{ UnityRenderTakesTime: "cache", UploadUnityRenderImageTakesTime: "cache", - UnityRealTakesTime: "cache", + UnityRealTakesTime: "cache", }, }) return diff --git a/server_api/resource.api b/server_api/resource.api index 7986dd5a..7f600ee0 100644 --- a/server_api/resource.api +++ b/server_api/resource.api @@ -70,11 +70,11 @@ type ( TemplateTagGroups []TemplateTagGroups `json:"template_tag_groups"` TemplateId int64 `json:"template_id"` // 合图参数 TemplateTag string `json:"template_tag"` // 合图参数 - Website string `json:"website,optional"` // 合图参数 - Slogan string `json:"slogan,optional"` // 合图参数 - Address string `json:"address,optional"` // 合图参数 - Phone string `json:"phone,optional"` // 合图参数 - Qrcode string `json:"qrcode,optional"` // 合图参数 + Website *string `json:"website,optional"` // 合图参数 + Slogan *string `json:"slogan,optional"` // 合图参数 + Address *string `json:"address,optional"` // 合图参数 + Phone *string `json:"phone,optional"` // 合图参数 + Qrcode *string `json:"qrcode,optional"` // 合图参数 } TemplateTagColor { Colors [][]string `json:"colors"` // 颜色组合 diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 0475fdec..a0402515 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -127,15 +127,16 @@ type ( ProductTemplateV2Info *gmodel.FsProductTemplateV2 `json:"product_template_v2_info"` ProductTemplateTagGroups interface{} `json:"product_template_tag_groups"` TemplateTag string `json:"template_tag"` - Website string `json:"website"` // 合图参数 - Slogan string `json:"slogan"` // 合图参数 - Address string `json:"address"` // 合图参数 - Phone string `json:"phone"` // 合图参数 - Qrcode string `json:"qrcode"` // 合图参数 LogoUrl string `json:"logo_url"` // 合图参数 Resolution string `json:"resolution"` // 合图参数 TemplateTagColor TemplateTagColor `json:"template_tag_color"` // 合图颜色 Debug *auth.Debug `json:"debug"` + + Website *string `json:"website"` // 合图参数 + Slogan *string `json:"slogan"` // 合图参数 + Address *string `json:"address"` // 合图参数 + Phone *string `json:"phone"` // 合图参数 + Qrcode *string `json:"qrcode"` // 合图参数 } LogoCombineRes struct { ResourceId string `json:"resource_id"` @@ -226,11 +227,22 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq json.Unmarshal(*resLogoInfo.Metadata, &combineParam) combineParam["resolution"] = in.Resolution combineParam["template_tagid"] = in.TemplateTag - combineParam["website"] = in.Website - combineParam["slogan"] = in.Slogan - combineParam["phone"] = in.Phone - combineParam["address"] = in.Address - combineParam["qrcode"] = in.Qrcode + if in.Website != nil { + combineParam["website"] = *in.Website + } + if in.Slogan != nil { + combineParam["slogan"] = *in.Slogan + } + if in.Phone != nil { + combineParam["phone"] = *in.Phone + } + if in.Address != nil { + combineParam["address"] = *in.Address + } + if in.Qrcode != nil { + combineParam["qrcode"] = *in.Qrcode + } + combineParam["template_tag_selected"] = map[string]interface{}{ "template_tag": in.TemplateTag, "color": in.TemplateTagColor.Color, From 24afaa8a91b527d6bb77cc444a8c1181b4d20a41 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Wed, 22 Nov 2023 15:22:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=88=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/websocket/internal/logic/ws_render_image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index baca87ff..b632f493 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -215,8 +215,8 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe ProductTemplateV2Info: productTemplate, ProductTemplateTagGroups: renderImageData.RenderData.TemplateTagGroups, TemplateTag: renderImageData.RenderData.TemplateTag, + Slogan: &renderImageData.RenderData.Slogan, // Website: &renderImageData.RenderData.Website, - // Slogan: &renderImageData.RenderData.Slogan, // Address: &renderImageData.RenderData.Address, // Phone: &renderImageData.RenderData.Phone, // Qrcode: &renderImageData.RenderData.Qrcode, From efe7e00821c3ae9ce800411f0debdaef90ee5832 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Wed, 22 Nov 2023 15:33:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=88=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/internal/logic/logocombinelogic.go | 2 +- server/resource/internal/types/types.go | 2 +- server_api/resource.api | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index 2a601548..b5e601d2 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -104,7 +104,7 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth GuestId: guestId, TemplateTag: req.TemplateTag, Website: req.Website, - Slogan: req.Slogan, + Slogan: &req.Slogan, Phone: req.Phone, Address: req.Address, Qrcode: req.Qrcode, diff --git a/server/resource/internal/types/types.go b/server/resource/internal/types/types.go index d7d8b473..bf23f3b1 100644 --- a/server/resource/internal/types/types.go +++ b/server/resource/internal/types/types.go @@ -38,8 +38,8 @@ type LogoCombineReq struct { TemplateTagGroups []TemplateTagGroups `json:"template_tag_groups"` TemplateId int64 `json:"template_id"` // 合图参数 TemplateTag string `json:"template_tag"` // 合图参数 + Slogan string `json:"slogan,optional"` // 合图参数 Website *string `json:"website,optional"` // 合图参数 - Slogan *string `json:"slogan,optional"` // 合图参数 Address *string `json:"address,optional"` // 合图参数 Phone *string `json:"phone,optional"` // 合图参数 Qrcode *string `json:"qrcode,optional"` // 合图参数 diff --git a/server_api/resource.api b/server_api/resource.api index 7f600ee0..fdf9a1e7 100644 --- a/server_api/resource.api +++ b/server_api/resource.api @@ -70,8 +70,8 @@ type ( TemplateTagGroups []TemplateTagGroups `json:"template_tag_groups"` TemplateId int64 `json:"template_id"` // 合图参数 TemplateTag string `json:"template_tag"` // 合图参数 + Slogan string `json:"slogan,optional"` // 合图参数 Website *string `json:"website,optional"` // 合图参数 - Slogan *string `json:"slogan,optional"` // 合图参数 Address *string `json:"address,optional"` // 合图参数 Phone *string `json:"phone,optional"` // 合图参数 Qrcode *string `json:"qrcode,optional"` // 合图参数