From fdcd485f9f82384eba4877f806e27c21691fc6b2 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sun, 8 Oct 2023 15:53:53 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/ws_render_image.go | 5 +++++ utils/websocket_data/render_data.go | 1 + 2 files changed, 6 insertions(+) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index f05108fe..600ff81d 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -136,6 +136,10 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "非法的logo", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) return } + if renderImageData.RenderData.Resolution == "" { + w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "请传入合图分辨率", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) + return + } lenColor := len(renderImageData.RenderData.TemplateTagColor.Colors) if lenColor == 0 { w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "请传入模板标签选择的颜色", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) @@ -200,6 +204,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe Color: renderImageData.RenderData.TemplateTagColor.Colors, Index: renderImageData.RenderData.TemplateTagColor.SelectedColorIndex, }, + Resolution: renderImageData.RenderData.Resolution, } res, err := w.logic.svcCtx.Repositories.ImageHandle.LogoCombine(w.logic.ctx, &combineReq) if err != nil { diff --git a/utils/websocket_data/render_data.go b/utils/websocket_data/render_data.go index 0508d27c..f6a141cc 100644 --- a/utils/websocket_data/render_data.go +++ b/utils/websocket_data/render_data.go @@ -17,6 +17,7 @@ type RenderData struct { TemplateTag string `json:"template_tag"` //模板标签(必须) TemplateTagColor TemplateTagColor `json:"template_tag_color"` //模板标签组合颜色(必须) TemplateTagGroups interface{} `json:"template_tag_groups"` //模板标签分组信息数组(必须) + Resolution string `json:"resolution"` //合图分辨率 Logo string `json:"logo"` //log资源地址(必须) ProductId int64 `json:"product_id"` //产品id(必须) Website string `json:"website"` //网站(可选)