Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
6381d258c0
|
@ -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级消息,单向通信)
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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: //新增任务
|
||||
|
|
|
@ -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))
|
||||
}
|
Loading…
Reference in New Issue
Block a user