From 3de3d896e8584a699f4f26bb1a79765d8fbdd917 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 19:06:46 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/ws_render_image.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 6793528c..6ce69165 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -101,10 +101,14 @@ func (w *wsConnectItem) renderImage(data []byte) { return } lenColor := len(renderImageData.RenderData.TemplateTagColor.Color) - if renderImageData.RenderData.TemplateTagColor.SelectedIndex >= lenColor || lenColor == 0 { + if lenColor == 0 { w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "请传入模板标签选择的颜色", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) return } + if renderImageData.RenderData.TemplateTagColor.SelectedIndex >= lenColor || renderImageData.RenderData.TemplateTagColor.SelectedIndex < 0 { + w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "选择的模板标签颜色索引越界", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) + return + } //获取产品信息(部分字段) productInfo, err := w.logic.svcCtx.AllModels.FsProduct.FindOne(w.logic.ctx, renderImageData.RenderData.ProductId, "id,is_customization") if err != nil {