From 3965512ef20cf3a3207cb434135305f58da1969d Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 27 Nov 2023 17:00:29 +0800 Subject: [PATCH] fix --- .../internal/logic/ws_render_image.go | 83 ++++++++++++++++++- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 87902472..8efc9ecf 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -363,6 +363,10 @@ func (w *wsConnectItem) getProductRelationInfo(renderImageData *websocket_data.R // 组装数据发送给unity func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, combineImage string, info websocket_data.RenderImageReqMsg, productTemplate *gmodel.FsProductTemplateV2, model3dInfo *gmodel.FsProductModel3d, element *gmodel.FsProductTemplateElement, productSize *gmodel.FsProductSize) (err error) { + if w.userId != 127 && info.RenderData.ProductId != 32 { + w.renderErrResponse(info.RequestId, info.RenderData.TemplateTag, taskId, "测试拦截,稍后开放", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId) + return err + } //组装数据 refletion := -1 if element.Refletion != nil && *element.Refletion != "" { @@ -386,7 +390,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, if element.Base != nil && *element.Base != "" { tempData = append(tempData, map[string]interface{}{ "name": "model", - "data": "0," + combineImage + "," + *element.Base, + "data": "0," + "卡扣式打包盒-1_MaskMap,卡扣式打包盒-1_Normal,卡扣式打包盒-1_BaseMap", "type": "other", "layer": "0", "is_update": 1, @@ -396,7 +400,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, if element.Shadow != nil && *element.Shadow != "" { tempData = append(tempData, map[string]interface{}{ "name": "shadow", - "data": *element.Shadow, + "data": "0,卡扣式打包盒-1,0,0,0", "type": "other", "layer": "0", "is_update": 0, @@ -404,15 +408,70 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, resolution int, }) } if element.ModelP != nil && *element.ModelP != "" { - tempData = append(tempData, map[string]interface{}{ + /*tempData = append(tempData, map[string]interface{}{ "name": "model_P", "data": "0," + *element.ModelP, "type": "other", "layer": "0", "is_update": 0, "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 + "," + "圆绳手提纸袋-S_MaskMap,圆绳手提纸袋-S_Normal,圆绳手提纸袋-S_BaseMap", + "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": "0,圆绳手提纸袋-S,0,0,0", + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["shadow"], + }) + } + if element.Base != nil && *element.Base != "" { + tempData = append(tempData, map[string]interface{}{ + "name": "model_2", + "data": "0," + combineImage + "," + "热饮单层纸杯-12oz_MaskMap,热饮单层纸杯-12oz_Normal,热饮单层纸杯-12oz_BaseMap", + "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": "0,热饮单层纸杯-12oz,0,0,0", + "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," + "热饮单层纸杯-12oz-杯盖,热饮单层纸杯-12oz-杯盖_MaskMap,热饮单层纸杯-12oz-杯盖_Normal,热饮单层纸杯-12oz-杯盖_BaseMap", + "type": "other", + "layer": "0", + "is_update": 0, + "mode": mode["model_P"], + }) + } + } + + //×××××××××××××××××××××××××××××××××××××××××××××××××××× result := []interface{}{ map[string]interface{}{ "light": *element.Light, @@ -425,6 +484,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": 10, + "sku_id": info.RenderData.ProductId, + "tid": "ceshi", + "rotation": *element.Rotation, + "filePath": "", //todo 文件路径,针对千人千面 + "data": tempData, + }, + } + } + //******************************* //发送运行阶段消息(组装数据) w.sendAssembleRenderDataStepResponseMessage(info.RequestId) temId := websocket_data.ToUnityIdStruct{