diff --git a/server/websocket/internal/handler/datatransferhandler.go b/server/websocket/internal/handler/datatransferhandler.go index e07d3abe..9e0363eb 100644 --- a/server/websocket/internal/handler/datatransferhandler.go +++ b/server/websocket/internal/handler/datatransferhandler.go @@ -214,7 +214,7 @@ func (w *wsConnectItem) dealwithReciveData(data []byte) { defer w.mutex.Unlock() //把需要渲染的图片加进去 for _, v := range renderImageData { - key := getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId) + key := w.getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId) w.renderImage[key] = struct{}{} } default: @@ -223,6 +223,6 @@ func (w *wsConnectItem) dealwithReciveData(data []byte) { } // 获取需要渲染图片的map key -func getRenderImageMapKey(productId, sizeId, templateId int64) string { +func (w *wsConnectItem) getRenderImageMapKey(productId, sizeId, templateId int64) string { return fmt.Sprintf("%d-%d-%d", productId, sizeId, templateId) } diff --git a/server/websocket/internal/handler/rendernotifyhandler.go b/server/websocket/internal/handler/rendernotifyhandler.go index 9c2eb28d..6dde0c3f 100644 --- a/server/websocket/internal/handler/rendernotifyhandler.go +++ b/server/websocket/internal/handler/rendernotifyhandler.go @@ -39,7 +39,7 @@ func setOutRenderImage(req types.RenderNotifyReq, ws wsConnectItem) { ws.mutex.Lock() defer ws.mutex.Unlock() for _, notifyItem := range req.NotifyList { - renderKey := getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId) + renderKey := ws.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId) //加载并删除 _, ok := ws.renderImage[renderKey] if !ok {