fix
This commit is contained in:
parent
2ae6c0cf85
commit
70544827cd
|
@ -5,8 +5,8 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/server/websocket/internal/websocket_data"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/websocket_data"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
|
@ -7,11 +7,10 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
websocket_data2 "fusenapi/server/websocket/internal/websocket_data"
|
||||
"fusenapi/service/repositories"
|
||||
"fusenapi/utils/curl"
|
||||
"fusenapi/utils/hash"
|
||||
"fusenapi/utils/websocket_data"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
|
@ -76,7 +75,7 @@ func (w *wsConnectItem) renderImage() {
|
|||
// 消费渲染缓冲数据
|
||||
func (w *wsConnectItem) consumeRenderCache(data []byte) {
|
||||
logx.Info("消费渲染数据:", string(data))
|
||||
var renderImageData websocket_data.RenderImageReqMsg
|
||||
var renderImageData websocket_data2.RenderImageReqMsg
|
||||
if err := json.Unmarshal(data, &renderImageData); err != nil {
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, "invalid format of websocket render image message:"+string(data)))
|
||||
logx.Error("invalid format of websocket render image message", err)
|
||||
|
@ -142,7 +141,7 @@ func (w *wsConnectItem) consumeRenderCache(data []byte) {
|
|||
}
|
||||
} else {
|
||||
//返回给客户端
|
||||
b := w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data.RenderImageRspMsg{
|
||||
b := w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data2.RenderImageRspMsg{
|
||||
RenderId: renderImageData.RenderId,
|
||||
Image: *resource.ResourceUrl,
|
||||
CombineTakesTime: "耗时0秒(缓存)",
|
||||
|
@ -167,7 +166,7 @@ func (w *wsConnectItem) consumeRenderCache(data []byte) {
|
|||
}
|
||||
|
||||
// 组装数据发送给unity
|
||||
func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.RenderImageReqMsg) error {
|
||||
func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data2.RenderImageReqMsg) error {
|
||||
//获取产品第一个尺寸
|
||||
productFirstSize, err := w.logic.svcCtx.AllModels.FsProductSize.GetProductFirstSize(w.logic.ctx, info.RenderData.ProductId)
|
||||
if err != nil {
|
||||
|
@ -429,7 +428,7 @@ func (w *wsConnectItem) operationRenderTask() {
|
|||
UnityRenderTakesTime = fmt.Sprintf("耗时%d秒", taskData.UnityRenderEndTime-taskData.UnityRenderBeginTime)
|
||||
}
|
||||
//发送到出口
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data.RenderImageRspMsg{
|
||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data2.RenderImageRspMsg{
|
||||
RenderId: taskData.RenderId,
|
||||
Image: data.RenderNotifyImageUrl,
|
||||
CombineTakesTime: CombineTakesTime,
|
||||
|
|
|
@ -2,7 +2,7 @@ package websocket_data
|
|||
|
||||
import "fusenapi/constants"
|
||||
|
||||
// websocket数据交互
|
||||
// websocket数据交互基本数据类型
|
||||
type DataTransferData struct {
|
||||
T constants.Websocket `json:"t"` //消息类型
|
||||
D interface{} `json:"d"` //传递的消息
|
Loading…
Reference in New Issue
Block a user