fusenapi/server/websocket/internal/logic/ws_ok_response.go
laodaming bef22ffbcc fix
2023-10-18 17:22:07 +08:00

64 lines
2.2 KiB
Go

package logic
import (
"fmt"
"fusenapi/constants"
"fusenapi/utils/auth"
"fusenapi/utils/websocket_data"
)
// *******************************合图相关begin******************************
// 发送合图完毕阶段通知消息
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId int64, debugData *auth.DebugData) {
if w.debug == nil {
return
}
combineTakesTime := "cache"
uploadCombineImageTakesTime := "cache"
if debugData.DiffTimeLogoCombine > 0 {
combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine)
}
if debugData.DiffTimeUploadFile > 0 {
uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile)
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
RenderId: renderId,
RequestId: requestId,
CombineImage: combineImage,
SizeId: sizeId,
ModelId: modelId,
TemplateId: templateId,
CombineProcessTime: websocket_data.CombineProcessTime{
CombineTakesTime: combineTakesTime,
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
},
}))
}
// 发送组装unity需要的数据完毕消息
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送组装数据到unity完毕阶段通知消息
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送渲染最终结果数据到前端
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
//没开启debug
if w.debug == nil {
data.RenderProcessTime = websocket_data.RenderProcessTime{}
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
}
// *******************************合图相关end******************************