From 31eb49efa305b35252833990af38f9ca2b2fc659 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 7 Aug 2023 11:49:17 +0800 Subject: [PATCH] fix --- server/render/render.go | 2 +- server/websocket/internal/logic/ws_render_image_logic.go | 7 +------ utils/websocket_data/render_data.go | 6 ++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/render/render.go b/server/render/render.go index 2c052f37..1210715d 100644 --- a/server/render/render.go +++ b/server/render/render.go @@ -32,12 +32,12 @@ func main() { defer server.Stop() ctx := svc.NewServiceContext(c) - handler.RegisterHandlers(server, ctx) //消费渲染前组装数据队列 ctx1 := context.Background() ctx2, cancel := context.WithCancel(ctx1) defer cancel() go ctx.RabbitMq.Consume(ctx2, constants.RABBIT_MQ_ASSEMBLE_RENDER_DATA, &consumer.MqConsumerRenderAssemble{}) + handler.RegisterHandlers(server, ctx) fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) server.Start() } diff --git a/server/websocket/internal/logic/ws_render_image_logic.go b/server/websocket/internal/logic/ws_render_image_logic.go index 5be69551..e4881bba 100644 --- a/server/websocket/internal/logic/ws_render_image_logic.go +++ b/server/websocket/internal/logic/ws_render_image_logic.go @@ -22,11 +22,6 @@ type renderImageControlChanItem struct { } // 渲染发送到组装数据组装数据 -type assembleRenderData struct { - TaskId string `json:"task_id"` - RenderData interface{} `json:"render_data"` -} - func (w *wsConnectItem) assembleRenderData(data []byte) { var renderImageData websocket_data.RenderImageReqMsg if err := json.Unmarshal(data, &renderImageData); err != nil { @@ -42,7 +37,7 @@ func (w *wsConnectItem) assembleRenderData(data []byte) { TaskId: taskId, RenderId: renderImageData.RenderId, } - tmpData := assembleRenderData{ + tmpData := websocket_data.AssembleRenderData{ TaskId: taskId, RenderData: renderImageData.RenderData, } diff --git a/utils/websocket_data/render_data.go b/utils/websocket_data/render_data.go index 2e6c6a9e..3ec0067a 100644 --- a/utils/websocket_data/render_data.go +++ b/utils/websocket_data/render_data.go @@ -19,3 +19,9 @@ type ThirdPartyLoginRspMsg struct { //websocket三方登录的通知数据 Token string `json:"token"` } + +// 发送到渲染组装的mq数据 +type AssembleRenderData struct { + TaskId string `json:"task_id"` + RenderData interface{} `json:"render_data"` +}