fix
This commit is contained in:
parent
5a92db70eb
commit
436ed9ae4f
|
@ -234,14 +234,12 @@ func (w *wsConnectItem) sendLoop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 把要传递给客户端的数据放入outchan
|
// 把要传递给客户端的数据放入outchan
|
||||||
func (w *wsConnectItem) sendToOutChan(data [][]byte) {
|
func (w *wsConnectItem) sendToOutChan(data []byte) {
|
||||||
for _, v := range data {
|
select {
|
||||||
select {
|
case <-w.closeChan:
|
||||||
case <-w.closeChan:
|
return
|
||||||
return
|
case w.outChan <- data:
|
||||||
case w.outChan <- v:
|
logx.Info("notify send render result to out chan")
|
||||||
logx.Info("notify send render result to out chan")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq) (resp *basi
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
dataList := make([][]byte, 0, len(req.NotifyList))
|
|
||||||
//遍历数据
|
//遍历数据
|
||||||
for _, notifyItem := range req.NotifyList {
|
for _, notifyItem := range req.NotifyList {
|
||||||
renderKey := ws.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId)
|
renderKey := ws.getRenderImageMapKey(notifyItem.ProductId, notifyItem.SizeId, notifyItem.TemplateId)
|
||||||
|
@ -78,19 +77,18 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq) (resp *basi
|
||||||
ProductId: notifyItem.ProductId,
|
ProductId: notifyItem.ProductId,
|
||||||
SizeId: notifyItem.SizeId,
|
SizeId: notifyItem.SizeId,
|
||||||
TemplateId: notifyItem.TemplateId,
|
TemplateId: notifyItem.TemplateId,
|
||||||
Source: "我是渲染资源",
|
Source: notifyItem.Source,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(rspData)
|
b, _ := json.Marshal(rspData)
|
||||||
dataList = append(dataList, b)
|
|
||||||
//删除对应的需要渲染的图片map
|
//删除对应的需要渲染的图片map
|
||||||
ws.renderImageTaskCtlChan <- renderImageControlChanItem{
|
ws.renderImageTaskCtlChan <- renderImageControlChanItem{
|
||||||
Option: 0,
|
Option: 0, //0删除 1添加
|
||||||
Key: renderKey,
|
Key: renderKey,
|
||||||
}
|
}
|
||||||
|
//发送数据到out chan
|
||||||
|
ws.sendToOutChan(b)
|
||||||
}
|
}
|
||||||
//发送数据
|
|
||||||
ws.sendToOutChan(dataList)
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
return resp.SetStatus(basic.CodeOK)
|
return resp.SetStatus(basic.CodeOK)
|
||||||
|
|
|
@ -2,14 +2,12 @@ package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"fusenapi/server/websocket/internal/types"
|
"fusenapi/server/websocket/internal/types"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 渲染请求数据处理发送云渲染服务处理
|
// 渲染请求数据处理发送云渲染服务处理
|
||||||
func (w *wsConnectItem) SendToCloudRender(data []byte) {
|
func (w *wsConnectItem) SendToCloudRender(data []byte) {
|
||||||
fmt.Println(string(data))
|
|
||||||
var renderImageData []types.RenderImageReqMsg
|
var renderImageData []types.RenderImageReqMsg
|
||||||
if err := json.Unmarshal(data, &renderImageData); err != nil {
|
if err := json.Unmarshal(data, &renderImageData); err != nil {
|
||||||
logx.Error("invalid format of websocket render image message", err)
|
logx.Error("invalid format of websocket render image message", err)
|
||||||
|
@ -25,7 +23,7 @@ func (w *wsConnectItem) SendToCloudRender(data []byte) {
|
||||||
//加入渲染任务
|
//加入渲染任务
|
||||||
key := w.getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId)
|
key := w.getRenderImageMapKey(v.ProductId, v.SizeId, v.TemplateId)
|
||||||
w.renderImageTaskCtlChan <- renderImageControlChanItem{
|
w.renderImageTaskCtlChan <- renderImageControlChanItem{
|
||||||
Option: 1,
|
Option: 1, //0删除 1添加
|
||||||
Key: key,
|
Key: key,
|
||||||
}
|
}
|
||||||
// TODO 数据发送给云渲染服务器
|
// TODO 数据发送给云渲染服务器
|
||||||
|
|
Loading…
Reference in New Issue
Block a user