This commit is contained in:
laodaming 2023-07-25 17:12:37 +08:00
parent 9c72a8a4c9
commit 17aac7ad66
2 changed files with 3 additions and 3 deletions

View File

@ -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)
}

View File

@ -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 {