fix
This commit is contained in:
parent
a022e5a8d9
commit
37b5cc0f30
|
@ -1,16 +1,20 @@
|
||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/service/repositories"
|
"fusenapi/service/repositories"
|
||||||
|
"fusenapi/utils/curl"
|
||||||
"fusenapi/utils/hash"
|
"fusenapi/utils/hash"
|
||||||
"fusenapi/utils/websocket_data"
|
"fusenapi/utils/websocket_data"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 云渲染属性
|
// 云渲染属性
|
||||||
|
@ -234,20 +238,24 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re
|
||||||
"is_thousand_face": 0,
|
"is_thousand_face": 0,
|
||||||
"folder": "", //todo 千人千面需要使用
|
"folder": "", //todo 千人千面需要使用
|
||||||
}
|
}
|
||||||
/*b, _ := json.Marshal(sendData)
|
|
||||||
if err = rabbitmq.SendMsg(constants.RABBIT_MQ_TO_UNITY, b); err != nil {
|
|
||||||
logx.Error("发送渲染组装数据到rabbitmq失败:", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
logx.Info("发送渲染组装数据到unity成功")*/
|
|
||||||
// todo 请求unity接口 /api/render/queue/push
|
// todo 请求unity接口 /api/render/queue/push
|
||||||
logx.Info(sendData["id"])
|
url := "http://api.fusen.3718.cn:4050/api/render/queue/push"
|
||||||
//模拟发送回去(unity部署后要去掉)
|
header := make(map[string]string)
|
||||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data.RenderImageRspMsg{
|
header["content-type"] = "application/json"
|
||||||
RenderId: info.RenderId,
|
t := time.Now().UTC()
|
||||||
Image: "https://fusenh5.kayue.cn:8011/storage/test/final_k8TgMUxauc_temp.png",
|
postData := map[string]interface{}{
|
||||||
}))
|
"group": "unity3d",
|
||||||
|
"source": "home page",
|
||||||
|
"priority": 1,
|
||||||
|
"create_at": t,
|
||||||
|
"render_data": sendData,
|
||||||
|
}
|
||||||
|
p, _ := json.Marshal(postData)
|
||||||
|
_, err = curl.ApiCall(url, "POST", header, bytes.NewReader(p), time.Second*20)
|
||||||
|
if err != nil {
|
||||||
|
logx.Error("failed to send data to unity")
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作连接中渲染任务的增加/删除
|
// 操作连接中渲染任务的增加/删除
|
||||||
|
|
Loading…
Reference in New Issue
Block a user