From 6db48bd2b5ceff5cef65094be5bd7136c983161d Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 27 Nov 2023 15:45:45 +0800 Subject: [PATCH] fix --- .../internal/logic/ws_render_image.go | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 87902472..9af5620c 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -413,6 +413,71 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, "mode": mode["model_P"], }) } + //××××××××××××××××××××××××××××××××××××××××××××××××××××× + if w.userId == 127 { + if element.Base != nil && *element.Base != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "model_1", + "data": "0," + combineImage + "," + *element.Base, + "type": "other", + "layer": "0", + "is_update": 1, + "mode": mode["model"], + }) + } + if element.Shadow != nil && *element.Shadow != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "shadow_1", + "data": *element.Shadow, + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["shadow"], + }) + } + if element.ModelP != nil && *element.ModelP != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "model_P_1", + "data": "0," + *element.ModelP, + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["model_P_1"], + }) + } + if element.Base != nil && *element.Base != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "model_2", + "data": "0," + combineImage + "," + *element.Base, + "type": "other", + "layer": "0", + "is_update": 1, + "mode": mode["model"], + }) + } + if element.Shadow != nil && *element.Shadow != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "shadow_2", + "data": *element.Shadow, + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["shadow"], + }) + } + if element.ModelP != nil && *element.ModelP != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "model_P_2", + "data": "0," + *element.ModelP, + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["model_P"], + }) + } + } + + //×××××××××××××××××××××××××××××××××××××××××××××××××××× result := []interface{}{ map[string]interface{}{ "light": *element.Light, @@ -425,6 +490,22 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, "data": tempData, }, } + //************************** + if w.userId == 127 { + result = []interface{}{ + map[string]interface{}{ + "light": 22, + "refletion": refletion, + "scale": *element.Scale, + "sku_id": info.RenderData.ProductId, + "tid": *element.Title, + "rotation": *element.Rotation, + "filePath": "", //todo 文件路径,针对千人千面 + "data": tempData, + }, + } + } + //******************************* //发送运行阶段消息(组装数据) w.sendAssembleRenderDataStepResponseMessage(info.RequestId) temId := websocket_data.ToUnityIdStruct{ @@ -462,6 +543,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, } postDataBytes, _ := json.Marshal(postData) beginPostTime := time.Now().UTC().UnixMilli() + logx.Info("请求unity接口数据:", string(postDataBytes)) _, err = curl.ApiCall(url, "POST", header, bytes.NewReader(postDataBytes), time.Second*10) if err != nil { w.renderErrResponse(info.RequestId, info.RenderData.TemplateTag, taskId, "请求unity接口失败", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)