From e07d55efca9089cfa7fd6136602cbbc372a30180 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 26 Jul 2023 15:08:43 +0800 Subject: [PATCH] fix --- .../internal/logic/datatransferlogic.go | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index fe187443..44810927 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -239,23 +239,6 @@ func (w *wsConnectItem) sendLoop() { } } -// 处理接受到的数据 -func (w *wsConnectItem) dealwithReciveData(data []byte) { - var parseInfo types.DataTransferData - if err := json.Unmarshal(data, &parseInfo); err != nil { - logx.Error("invalid format of websocket message") - return - } - //分消息类型给到不同逻辑处理,可扩展 - switch parseInfo.T { - //图片渲染 - case constants.WEBSOCKET_RENDER_IMAGE: - w.SendToCloudRender([]byte(parseInfo.D)) - default: - - } -} - // 把要传递给客户端的数据放入outchan func (w *wsConnectItem) sendToOutChan(data [][]byte) { for _, v := range data { @@ -272,3 +255,20 @@ func (w *wsConnectItem) sendToOutChan(data [][]byte) { func (w *wsConnectItem) getRenderImageMapKey(productId, sizeId, templateId int64) string { return fmt.Sprintf("%d-%d-%d", productId, sizeId, templateId) } + +// 处理接受到的数据 +func (w *wsConnectItem) dealwithReciveData(data []byte) { + var parseInfo types.DataTransferData + if err := json.Unmarshal(data, &parseInfo); err != nil { + logx.Error("invalid format of websocket message") + return + } + //分消息类型给到不同逻辑处理,可扩展 + switch parseInfo.T { + //图片渲染 + case constants.WEBSOCKET_RENDER_IMAGE: + w.SendToCloudRender([]byte(parseInfo.D)) + default: + + } +}