This commit is contained in:
laodaming 2023-07-26 15:08:43 +08:00
parent 34d5e62824
commit e07d55efca

View File

@ -239,23 +239,6 @@ func (w *wsConnectItem) sendLoop() {
}
}
// 处理接受到的数据
func (w *wsConnectItem) dealwithReciveData(data []byte) {
var parseInfo types.DataTransferData
if err := json.Unmarshal(data, &parseInfo); err != nil {
logx.Error("invalid format of websocket message")
return
}
//分消息类型给到不同逻辑处理,可扩展
switch parseInfo.T {
//图片渲染
case constants.WEBSOCKET_RENDER_IMAGE:
w.SendToCloudRender([]byte(parseInfo.D))
default:
}
}
// 把要传递给客户端的数据放入outchan
func (w *wsConnectItem) sendToOutChan(data [][]byte) {
for _, v := range data {
@ -272,3 +255,20 @@ func (w *wsConnectItem) sendToOutChan(data [][]byte) {
func (w *wsConnectItem) getRenderImageMapKey(productId, sizeId, templateId int64) string {
return fmt.Sprintf("%d-%d-%d", productId, sizeId, templateId)
}
// 处理接受到的数据
func (w *wsConnectItem) dealwithReciveData(data []byte) {
var parseInfo types.DataTransferData
if err := json.Unmarshal(data, &parseInfo); err != nil {
logx.Error("invalid format of websocket message")
return
}
//分消息类型给到不同逻辑处理,可扩展
switch parseInfo.T {
//图片渲染
case constants.WEBSOCKET_RENDER_IMAGE:
w.SendToCloudRender([]byte(parseInfo.D))
default:
}
}