From 3cd976976a5ae68151e1dca589a686738fc10dfb Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 2 Nov 2023 16:00:49 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/rendernotifylogic.go | 8 ++++---- server/websocket/internal/logic/ws_render_image.go | 2 ++ server/websocket/internal/types/types.go | 10 ++++------ server_api/websocket.api | 10 ++++------ utils/websocket_data/render_data.go | 2 ++ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server/websocket/internal/logic/rendernotifylogic.go b/server/websocket/internal/logic/rendernotifylogic.go index 33913fb8..e8cf4103 100644 --- a/server/websocket/internal/logic/rendernotifylogic.go +++ b/server/websocket/internal/logic/rendernotifylogic.go @@ -50,10 +50,10 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a if info.RenderBeginTime > serverStartTime { //logx.Info("任务时间:", info.RenderBeginTime, "服务器启动时间:", serverStartTime) //统计unity处理数 - decreaseUnityRequestCount(req.UserId, req.GuestId) + decreaseUnityRequestCount(info.UserId, info.GuestId) if req.Code != 0 { //统计unity失败处理数 - increaseUnityErrorCount(req.UserId, req.GuestId) + increaseUnityErrorCount(info.UserId, info.GuestId) } } //重新赋值(很重要) @@ -76,8 +76,8 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a Metadata: "", UploadBucket: 1, ApiType: 2, - UserId: req.UserId, - GuestId: req.GuestId, + UserId: info.UserId, + GuestId: info.GuestId, FileByte: nil, }) if err != nil { diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 15ef0eb3..bee8bf9a 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -400,6 +400,8 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, RequestId: info.RequestId, RenderBeginTime: time.Now().UTC().UnixMilli(), TemplateTag: info.RenderData.TemplateTag, + UserId: w.userId, + GuestId: w.guestId, } temIdBytes, _ := json.Marshal(temId) sendData := map[string]interface{}{ diff --git a/server/websocket/internal/types/types.go b/server/websocket/internal/types/types.go index 18d63791..98834e01 100644 --- a/server/websocket/internal/types/types.go +++ b/server/websocket/internal/types/types.go @@ -10,12 +10,10 @@ type DataTransferReq struct { } type RenderNotifyReq struct { - TaskId string `json:"task_id"` - UserId int64 `json:"user_id"` - GuestId int64 `json:"guest_id"` - Image string `json:"image"` - Code int `json:"code,optional"` - Msg string `json:"msg,optional"` + TaskId string `json:"task_id"` + Image string `json:"image"` + Code int `json:"code,optional"` + Msg string `json:"msg,optional"` } type CommonNotifyReq struct { diff --git a/server_api/websocket.api b/server_api/websocket.api index 930ab7c2..05bb375b 100644 --- a/server_api/websocket.api +++ b/server_api/websocket.api @@ -32,12 +32,10 @@ type DataTransferReq { } //渲染完了通知接口 type RenderNotifyReq { - TaskId string `json:"task_id"` - UserId int64 `json:"user_id"` - GuestId int64 `json:"guest_id"` - Image string `json:"image"` - Code int `json:"code,optional"` - Msg string `json:"msg,optional"` + TaskId string `json:"task_id"` + Image string `json:"image"` + Code int `json:"code,optional"` + Msg string `json:"msg,optional"` } //通用回调接口 type CommonNotifyReq { diff --git a/utils/websocket_data/render_data.go b/utils/websocket_data/render_data.go index c0047b55..8d0a8136 100644 --- a/utils/websocket_data/render_data.go +++ b/utils/websocket_data/render_data.go @@ -68,4 +68,6 @@ type ToUnityIdStruct struct { RequestId string `json:"request_id"` RenderBeginTime int64 `json:"render_begin_time"` TemplateTag string `json:"template_tag"` + UserId int64 `json:"user_id"` + GuestId int64 `json:"guest_id"` }