From dd71063cdbd8571422e084677b8b29a704515f08 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 22 Nov 2023 16:34:26 +0800 Subject: [PATCH] fix --- .../internal/logic/ws_ok_response.go | 55 +++++++++++-------- utils/websocket_data/render_data.go | 13 +++-- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/server/websocket/internal/logic/ws_ok_response.go b/server/websocket/internal/logic/ws_ok_response.go index 70ac842a..75c5018b 100644 --- a/server/websocket/internal/logic/ws_ok_response.go +++ b/server/websocket/internal/logic/ws_ok_response.go @@ -10,33 +10,40 @@ import ( // *******************************合图相关begin****************************** // 发送合图完毕阶段通知消息 func (w *wsConnectItem) sendCombineImageStepResponseMessage(requestId, combineImage string, sizeId, modelId, templateId int64, debugData *auth.DebugData) { - if w.debug == nil { - return - } combineTakesTime := "" uploadCombineImageTakesTime := "" - //开了缓存 - if w.debug.IsCache != 0 { - combineTakesTime = "cache" - uploadCombineImageTakesTime = "cache" + if w.debug != nil { //开启debug + //开了缓存 + if w.debug.IsCache != 0 { + combineTakesTime = "cache" + uploadCombineImageTakesTime = "cache" + } + if debugData != nil && debugData.DiffTimeLogoCombine > 0 { + combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine) + } + if debugData != nil && debugData.DiffTimeUploadFile > 0 { + uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile) + } + w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{ + RequestId: requestId, + CombineImage: combineImage, + CombineRelative: &websocket_data.CombineRelative{ + SizeId: sizeId, + ModelId: modelId, + TemplateId: templateId, + }, + CombineProcessTime: &websocket_data.CombineProcessTime{ + CombineTakesTime: combineTakesTime, + UploadCombineImageTakesTime: uploadCombineImageTakesTime, + }, + })) + } else { + w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{ + RequestId: requestId, + CombineImage: combineImage, + })) } - if debugData != nil && debugData.DiffTimeLogoCombine > 0 { - combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine) - } - if debugData != nil && debugData.DiffTimeUploadFile > 0 { - uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile) - } - w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{ - RequestId: requestId, - CombineImage: combineImage, - SizeId: sizeId, - ModelId: modelId, - TemplateId: templateId, - CombineProcessTime: &websocket_data.CombineProcessTime{ - CombineTakesTime: combineTakesTime, - UploadCombineImageTakesTime: uploadCombineImageTakesTime, - }, - })) + } // 发送组装unity需要的数据完毕消息 diff --git a/utils/websocket_data/render_data.go b/utils/websocket_data/render_data.go index 1aa69ddd..4d39a94d 100644 --- a/utils/websocket_data/render_data.go +++ b/utils/websocket_data/render_data.go @@ -35,18 +35,21 @@ type RenderImageRspMsg struct { type RenderProcessTime struct { UnityRenderTakesTime string `json:"unity_render_takes_time"` //unity渲染用时 UploadUnityRenderImageTakesTime string `json:"upload_unity_render_image_takes_time"` //上传unity渲染结果图时间 - UnityRealTakesTime string `json:"unity_real_takes_time"`//unity真实处理时间 + UnityRealTakesTime string `json:"unity_real_takes_time"` //unity真实处理时间 } // 合图返回数据 type CombineImageRspMsg struct { RequestId string `json:"request_id"` - CombineImage string `json:"combine_image"` //刀版图 - SizeId int64 `json:"size_id"` //尺寸id - ModelId int64 `json:"model_id"` - TemplateId int64 `json:"template_id"` + CombineImage string `json:"combine_image"` //刀版图 + CombineRelative *CombineRelative `json:"combine_relative"` //合图相关数据 CombineProcessTime *CombineProcessTime `json:"combine_process_time"` } +type CombineRelative struct { + SizeId int64 `json:"size_id"` //尺寸id + ModelId int64 `json:"model_id"` + TemplateId int64 `json:"template_id"` +} type CombineProcessTime struct { CombineTakesTime string `json:"combine_takes_time"` //合图时间 UploadCombineImageTakesTime string `json:"upload_combine_image_takes_time"` //上传刀版图耗时