fusenapi/server/websocket/internal/logic/ws_render_image_logic.go
laodaming ae58ebe35a fix
2023-07-26 15:05:53 +08:00

26 lines
749 B
Go

package logic
import (
"encoding/json"
"fusenapi/server/websocket/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
// 渲染请求数据处理发送云渲染服务处理
func (w *wsConnectItem) SendToCloudRender(data []byte) {
var renderImageData []types.RenderImageReqMsg
if err := json.Unmarshal(data, &renderImageData); err != nil {
logx.Error("invalid format of websocket render image message", err)
return
}
logx.Info("收到请求云渲染图片数据:", renderImageData)
//把需要渲染的图片任务加进去
for _, v := range renderImageData {
key := w.getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId)
w.renderImageTaskCtlChan <- renderImageControlChanItem{
Option: 1,
Key: key,
}
}
}