This commit is contained in:
laodaming 2023-10-26 10:59:56 +08:00
parent 832b68752b
commit ebd4d88f31

View File

@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"fusenapi/model/gmodel"
"fusenapi/service/repositories"
"fusenapi/utils/curl"
@ -430,12 +431,14 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st
"render_data": sendData,
}
postDataBytes, _ := json.Marshal(postData)
beginPostTime := time.Now().UTC().UnixMilli()
_, err = curl.ApiCall(url, "POST", header, bytes.NewReader(postDataBytes), time.Second*10)
if err != nil {
w.renderErrResponse(info.RenderId, info.RequestId, info.RenderData.TemplateTag, taskId, "请求unity接口失败", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
logx.Error("failed to send data to unity")
return err
}
logx.Info(fmt.Sprintf("发送unity post数据耗时:%d", time.Now().UTC().UnixMilli()-beginPostTime))
//发送运行阶段消息
w.sendRenderDataToUnityStepResponseMessage(info.RenderId, info.RequestId)
logx.Info("发送到unity成功,刀版图:", combineImage /*, " 请求unity的数据:", string(postDataBytes)*/)