11
This commit is contained in:
parent
921098650e
commit
06b1ad1678
|
@ -51,13 +51,14 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
unityRenderEndTime := time.Now().UTC().UnixMilli()
|
unityRenderEndTime := time.Now().UTC().UnixMilli()
|
||||||
//解析出真的taskId跟wid
|
//解析出真的taskId跟wid
|
||||||
splitSlice := strings.Split(req.TaskId, " ")
|
splitSlice := strings.Split(req.TaskId, " ")
|
||||||
if len(splitSlice) != 2 {
|
if len(splitSlice) != 3 {
|
||||||
logx.Error("渲染回调参数错误:task_id拆分得不到合理结果")
|
logx.Error("渲染回调参数错误:task_id拆分得不到合理结果")
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id!!")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id!!")
|
||||||
}
|
}
|
||||||
//重新赋值(很重要)
|
//重新赋值(很重要)
|
||||||
req.TaskId = splitSlice[0]
|
req.TaskId = splitSlice[0]
|
||||||
wid := splitSlice[1]
|
wid := splitSlice[1]
|
||||||
|
renderId := splitSlice[2]
|
||||||
//存base64打印测试
|
//存base64打印测试
|
||||||
/* f, _ := os.Create("b.txt")
|
/* f, _ := os.Create("b.txt")
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
@ -94,7 +95,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
//记录收到unity渲染结果时间以及上传渲染图耗时时间
|
//记录收到unity渲染结果时间以及上传渲染图耗时时间
|
||||||
ws.modifyRenderTaskProperty(req.TaskId, renderTask{unityRenderEndTime: unityRenderEndTime, uploadUnityRenderImageTakesTime: uploadUnityRenderImageTakesTime})
|
ws.modifyRenderTaskProperty(req.TaskId, renderTask{unityRenderEndTime: unityRenderEndTime, uploadUnityRenderImageTakesTime: uploadUnityRenderImageTakesTime})
|
||||||
//发送处理并删除任务
|
//发送处理并删除任务
|
||||||
ws.deleteRenderTask(req.TaskId, uploadRes.ResourceUrl)
|
ws.deleteRenderTask(req.TaskId, renderId, uploadRes.ResourceUrl)
|
||||||
}
|
}
|
||||||
logx.Info("渲染回调成功,渲染结果图片为:", uploadRes.ResourceUrl)
|
logx.Info("渲染回调成功,渲染结果图片为:", uploadRes.ResourceUrl)
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
||||||
|
|
|
@ -401,7 +401,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st
|
||||||
//发送运行阶段消息(组装数据)
|
//发送运行阶段消息(组装数据)
|
||||||
w.sendAssembleRenderDataStepResponseMessage(info.RenderId)
|
w.sendAssembleRenderDataStepResponseMessage(info.RenderId)
|
||||||
sendData := map[string]interface{}{
|
sendData := map[string]interface{}{
|
||||||
"id": taskId + " " + w.uniqueId, //空格分开
|
"id": taskId + " " + w.uniqueId + " " + info.RenderId, //空格分开
|
||||||
"order_id": 0,
|
"order_id": 0,
|
||||||
"user_id": info.RenderData.UserId,
|
"user_id": info.RenderData.UserId,
|
||||||
"guest_id": info.RenderData.GuestId,
|
"guest_id": info.RenderData.GuestId,
|
||||||
|
@ -502,7 +502,7 @@ func (w *wsConnectItem) createRenderTask(taskId, renderId string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渲染回调处理并删除渲染任务
|
// 渲染回调处理并删除渲染任务
|
||||||
func (w *wsConnectItem) deleteRenderTask(taskId, renderNotifyImageUrl string) {
|
func (w *wsConnectItem) deleteRenderTask(taskId, renderId, renderNotifyImageUrl string) {
|
||||||
if taskId == "" {
|
if taskId == "" {
|
||||||
logx.Error("task_id不能为空")
|
logx.Error("task_id不能为空")
|
||||||
return
|
return
|
||||||
|
@ -510,6 +510,7 @@ func (w *wsConnectItem) deleteRenderTask(taskId, renderNotifyImageUrl string) {
|
||||||
data := renderImageControlChanItem{
|
data := renderImageControlChanItem{
|
||||||
option: 0,
|
option: 0,
|
||||||
taskId: taskId,
|
taskId: taskId,
|
||||||
|
renderId: renderId,
|
||||||
renderNotifyImageUrl: renderNotifyImageUrl,
|
renderNotifyImageUrl: renderNotifyImageUrl,
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
|
@ -587,6 +588,15 @@ func (w *wsConnectItem) operationRenderTask() {
|
||||||
case 0: //渲染结果回调,删除任务
|
case 0: //渲染结果回调,删除任务
|
||||||
taskData, ok := w.extendRenderProperty.renderImageTask[data.taskId]
|
taskData, ok := w.extendRenderProperty.renderImageTask[data.taskId]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
//发送到出口
|
||||||
|
w.sendRenderResultData(websocket_data.RenderImageRspMsg{
|
||||||
|
RenderId: data.renderId, //没有找到任务渲染id则用传进来的
|
||||||
|
Image: data.renderNotifyImageUrl,
|
||||||
|
RenderProcessTime: websocket_data.RenderProcessTime{
|
||||||
|
UnityRenderTakesTime: "unknown",
|
||||||
|
UploadUnityRenderImageTakesTime: "unknown",
|
||||||
|
},
|
||||||
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
//删除任务
|
//删除任务
|
||||||
|
|
Loading…
Reference in New Issue
Block a user