Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-08-31 16:17:36 +08:00
commit 6381d258c0
6 changed files with 24 additions and 5 deletions

View File

@ -30,3 +30,8 @@ const (
WEBSOCKET_ASSEMBLE_RENDER_DATA Websocket = "WEBSOCKET_ASSEMBLE_RENDER_DATA" //组装unity需要的数据 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_SEND_DATA_TO_UNITY Websocket = "WEBSOCKET_SEND_DATA_TO_UNITY" //发送到unity进行渲染 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
)
// websocket消息类型系统数据变更通知
const (
WEBSOCKET_SYSTEM_DATA_UPDATE_NOTIFY Websocket = "WEBSOCKET_SYSTEM_DATA_UPDATE_NOTIFY" //系统数据更新(1级消息单向通信)
)

View File

@ -3,6 +3,8 @@ Host: 0.0.0.0
Port: 9914
ReplicaId: 95
Timeout: 15000 #服务超时时间
CertFile: "/opt/server.fusen.3718.cn.pem"
KeyFile: "/opt/server.fusen.3718.cn.key"
SourceMysql: "fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"
Log:
Stat: false

View File

@ -37,6 +37,7 @@ func NewRenderNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Rend
// }
func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) {
logx.Info("收到unity返回消息----")
if req.TaskId == "" {
logx.Error("渲染回调参数错误:任务标识")
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id")

View File

@ -218,7 +218,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
}
} else {
//返回给客户端
b := w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data.RenderImageRspMsg{
w.sendRenderResultData(websocket_data.RenderImageRspMsg{
RenderId: renderImageData.RenderId,
Image: *resource.ResourceUrl,
RenderProcessTime: websocket_data.RenderProcessTime{
@ -228,8 +228,6 @@ func (w *wsConnectItem) renderImage(data []byte) {
UploadUnityRenderImageTakesTime: "cache",
},
})
//发送数据到out chan
w.sendToOutChan(b)
return
}
//###########################################
@ -387,6 +385,11 @@ func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId}))
}
// 发送渲染最终结果数据到前端
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
}
// 增加渲染任务
func (w *wsConnectItem) createRenderTask(data renderImageControlChanItem) {
if data.taskId == "" {
@ -511,7 +514,7 @@ func (w *wsConnectItem) operationRenderTask() {
uploadUnityRenderImageTakesTime = fmt.Sprintf("%dms", taskData.uploadUnityRenderImageTakesTime)
}
//发送到出口
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, websocket_data.RenderImageRspMsg{
w.sendRenderResultData(websocket_data.RenderImageRspMsg{
RenderId: taskData.renderId,
Image: data.renderNotifyImageUrl,
RenderProcessTime: websocket_data.RenderProcessTime{
@ -520,7 +523,7 @@ func (w *wsConnectItem) operationRenderTask() {
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
UploadUnityRenderImageTakesTime: uploadUnityRenderImageTakesTime,
},
}))
})
//删除任务
delete(w.extendRenderProperty.renderImageTask, data.taskId)
case 1: //新增任务

View File

@ -0,0 +1,8 @@
package logic
import "fusenapi/constants"
// 发送系统更新数据给前端
func (w *wsConnectItem) sendSystemDataUpdateNotifyMessage(data interface{}) {
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SYSTEM_DATA_UPDATE_NOTIFY, data))
}