fix
This commit is contained in:
@@ -258,11 +258,12 @@ func (w *wsConnectItem) dealwithReciveData(data []byte) {
|
||||
logx.Error("invalid format of websocket message")
|
||||
return
|
||||
}
|
||||
d, _ := json.Marshal(parseInfo.D)
|
||||
//分消息类型给到不同逻辑处理,可扩展
|
||||
switch parseInfo.T {
|
||||
//图片渲染
|
||||
case constants.WEBSOCKET_RENDER_IMAGE:
|
||||
go w.SendToCloudRender([]byte(parseInfo.D))
|
||||
go w.SendToCloudRender(d)
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
@@ -72,13 +72,16 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq) (resp *basi
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
responseData := types.RenderImageRspMsg{
|
||||
ProductId: notifyItem.ProductId,
|
||||
SizeId: notifyItem.SizeId,
|
||||
TemplateId: notifyItem.TemplateId,
|
||||
Source: "我是渲染资源",
|
||||
rspData := types.DataTransferData{
|
||||
T: constants.WEBSOCKET_RENDER_IMAGE,
|
||||
D: types.RenderImageRspMsg{
|
||||
ProductId: notifyItem.ProductId,
|
||||
SizeId: notifyItem.SizeId,
|
||||
TemplateId: notifyItem.TemplateId,
|
||||
Source: "我是渲染资源",
|
||||
},
|
||||
}
|
||||
b, _ := json.Marshal(responseData)
|
||||
b, _ := json.Marshal(rspData)
|
||||
dataList = append(dataList, b)
|
||||
//删除对应的需要渲染的图片map
|
||||
ws.renderImageTaskCtlChan <- renderImageControlChanItem{
|
||||
|
||||
@@ -2,12 +2,14 @@ package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"fusenapi/server/websocket/internal/types"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
// 渲染请求数据处理发送云渲染服务处理
|
||||
func (w *wsConnectItem) SendToCloudRender(data []byte) {
|
||||
fmt.Println(string(data))
|
||||
var renderImageData []types.RenderImageReqMsg
|
||||
if err := json.Unmarshal(data, &renderImageData); err != nil {
|
||||
logx.Error("invalid format of websocket render image message", err)
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
)
|
||||
|
||||
type DataTransferData struct {
|
||||
T string `json:"t"` //消息类型
|
||||
D string `json:"d"` //传递的消息
|
||||
T string `json:"t"` //消息类型
|
||||
D interface{} `json:"d"` //传递的消息
|
||||
}
|
||||
|
||||
type RenderImageReqMsg struct {
|
||||
|
||||
Reference in New Issue
Block a user