This commit is contained in:
laodaming 2023-11-27 15:45:45 +08:00
parent 22228b5bb2
commit 6db48bd2b5

View File

@ -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)