diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 6a3b206f..6566d2d7 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -52,8 +52,8 @@ type wsConnectItem struct { inChan chan []byte //接受消息缓冲通道 outChan chan []byte //发送回客户端的消息 mutex sync.Mutex - renderImage map[string]struct{} //需要渲染的图片 - renderImageControlChan chan renderImageControlChanItem + renderImageTask map[string]struct{} //需要渲染的图片 + renderImageTaskCtlChan chan renderImageControlChanItem } type renderImageControlChanItem struct { Option int // 0删除 1添加 @@ -115,8 +115,8 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp closeChan: make(chan struct{}, 1), inChan: make(chan []byte, 100), outChan: make(chan []byte, 100), - renderImage: make(map[string]struct{}), - renderImageControlChan: make(chan renderImageControlChanItem, 100), + renderImageTask: make(map[string]struct{}), + renderImageTaskCtlChan: make(chan renderImageControlChanItem, 100), isClose: false, } //保存连接 @@ -183,12 +183,12 @@ func (w *wsConnectItem) operationRenderTask() { select { case <-w.closeChan: return - case data := <-w.renderImageControlChan: + case data := <-w.renderImageTaskCtlChan: switch data.Option { case 0: //删除 - delete(w.renderImage, data.Key) + delete(w.renderImageTask, data.Key) case 1: //新增 - w.renderImage[data.Key] = struct{}{} + w.renderImageTask[data.Key] = struct{}{} default: } diff --git a/server/websocket/internal/logic/rendernotifylogic.go b/server/websocket/internal/logic/rendernotifylogic.go index aa504999..01f630de 100644 --- a/server/websocket/internal/logic/rendernotifylogic.go +++ b/server/websocket/internal/logic/rendernotifylogic.go @@ -67,8 +67,8 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq) (resp *basi //遍历数据 for _, notifyItem := range req.NotifyList { renderKey := ws.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId) - //查询 - _, ok = ws.renderImage[renderKey] + //查询有无该渲染任务 + _, ok = ws.renderImageTask[renderKey] if !ok { continue } @@ -81,7 +81,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq) (resp *basi b, _ := json.Marshal(responseData) dataList = append(dataList, b) //删除对应的需要渲染的图片map - ws.renderImageControlChan <- renderImageControlChanItem{ + ws.renderImageTaskCtlChan <- renderImageControlChanItem{ Option: 0, Key: renderKey, } diff --git a/server/websocket/internal/logic/ws_render_image_logic.go b/server/websocket/internal/logic/ws_render_image_logic.go index 46c742ba..40c07f1e 100644 --- a/server/websocket/internal/logic/ws_render_image_logic.go +++ b/server/websocket/internal/logic/ws_render_image_logic.go @@ -14,10 +14,10 @@ func (w *wsConnectItem) SendToCloudRender(data []byte) { return } logx.Info("收到请求云渲染图片数据:", renderImageData) - //把需要渲染的图片加进去 + //把需要渲染的图片任务加进去 for _, v := range renderImageData { key := w.getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId) - w.renderImageControlChan <- renderImageControlChanItem{ + w.renderImageTaskCtlChan <- renderImageControlChanItem{ Option: 1, Key: key, }