1
This commit is contained in:
parent
4c45b2287a
commit
37d824a7d9
|
@ -8,11 +8,12 @@ func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
|
|||
}
|
||||
|
||||
// 渲染错误通知
|
||||
func (w *wsConnectItem) renderErrResponse(renderId, templateTag, taskId, description string, userId, guestId, templateId, modelId, sizeId, elementModelId int64) {
|
||||
func (w *wsConnectItem) renderErrResponse(renderId, templateTag, taskId, description string, productId, userId, guestId, templateId, modelId, sizeId, elementModelId int64) {
|
||||
data := make(map[string]interface{})
|
||||
data["render_id"] = renderId
|
||||
data["description"] = description
|
||||
data["template_tag"] = templateTag
|
||||
data["product_id"] = productId
|
||||
if taskId != "" {
|
||||
data["task_id"] = taskId
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
userMaterial, err := w.logic.svcCtx.AllModels.FsUserMaterial.FindLatestOne(w.logic.ctx, w.userId, w.guestId)
|
||||
if err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get user logo", w.userId, w.guestId, 0, 0, 0, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get user logo", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
logx.Error("failed to get user logo")
|
||||
return
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
userMaterialDefault, err := w.logic.svcCtx.AllModels.FsUserMaterial.FindOneById(w.logic.ctx, 0)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "default logo is not exists", w.userId, w.guestId, 0, 0, 0, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "default logo is not exists", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get default logo", w.userId, w.guestId, 0, 0, 0, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get default logo", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
logx.Error("default logo is not exists")
|
||||
return
|
||||
}
|
||||
|
@ -118,11 +118,11 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product first size is not exists", w.userId, w.guestId, 0, 0, renderImageData.RenderData.ProductSizeId, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product first size is not exists", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, renderImageData.RenderData.ProductSizeId, 0)
|
||||
logx.Error("product size is not found")
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product first size", w.userId, w.guestId, 0, 0, renderImageData.RenderData.ProductSizeId, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product first size", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, renderImageData.RenderData.ProductSizeId, 0)
|
||||
logx.Error("failed to get product size:", err)
|
||||
return
|
||||
}
|
||||
|
@ -130,11 +130,11 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
model3dInfo, err := w.logic.svcCtx.AllModels.FsProductModel3d.GetOneBySizeIdTag(w.logic.ctx, productSize.Id, constants.TAG_MODEL, "id")
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product model is not exists", w.userId, w.guestId, 0, 0, productSize.Id, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product model is not exists", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, productSize.Id, 0)
|
||||
logx.Error("product model is not found")
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product model", w.userId, w.guestId, 0, 0, productSize.Id, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product model", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, productSize.Id, 0)
|
||||
logx.Error("failed to get product model:", err)
|
||||
return
|
||||
}
|
||||
|
@ -142,11 +142,11 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
productTemplate, err := w.logic.svcCtx.AllModels.FsProductTemplateV2.FindFirstOneCloudRenderByProductIdModelIdTemplateTag(w.logic.ctx, renderImageData.RenderData.ProductId, model3dInfo.Id, renderImageData.RenderData.TemplateTag)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product template is not exists", w.userId, w.guestId, 0, model3dInfo.Id, productSize.Id, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "product template is not exists", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, model3dInfo.Id, productSize.Id, 0)
|
||||
logx.Error("template info is not found")
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product template", w.userId, w.guestId, 0, model3dInfo.Id, productSize.Id, 0)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get product template", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, model3dInfo.Id, productSize.Id, 0)
|
||||
logx.Error("failed to get template info:", err)
|
||||
return
|
||||
}
|
||||
|
@ -154,11 +154,11 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
element, err := w.logic.svcCtx.AllModels.FsProductTemplateElement.FindOneByModelId(w.logic.ctx, *productTemplate.ElementModelId)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "render element is not exists", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "render element is not exists", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("element info is not found,element_model_id = ", 0)
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get render element", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get render element", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("failed to get element ,", err)
|
||||
return
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
}
|
||||
res, err := w.logic.svcCtx.Repositories.ImageHandle.LogoCombine(w.logic.ctx, &combineReq)
|
||||
if err != nil {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to combine image:"+err.Error(), w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to combine image:"+err.Error(), renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("合成刀版图失败,合成请求数据:", combineReq, "错误信息:", err)
|
||||
return
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
if res != nil && res.ResourceUrl != nil {
|
||||
combineImage = *res.ResourceUrl
|
||||
} else {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "combine image is empty", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "combine image is empty", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("合成刀版图失败,合成的刀版图是空指针:", err)
|
||||
return
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
|||
resource, err := w.logic.svcCtx.AllModels.FsResource.FindOneById(w.logic.ctx, taskId)
|
||||
if err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, taskId, "failed to get render cache", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, taskId, "failed to get render cache", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("failed to find render resource:", err)
|
||||
return
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, combineImage string, i
|
|||
refletion, err = strconv.Atoi(*element.Refletion)
|
||||
if err != nil {
|
||||
logx.Error("err refletion:set default -1")
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Refletion from string to number err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Refletion from string to number err", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, combineImage string, i
|
|||
if element.Mode != nil && *element.Mode != "" {
|
||||
if err = json.Unmarshal([]byte(*element.Mode), &mode); err != nil {
|
||||
logx.Error("faile to parse element mode json:", err)
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Mode err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Mode err", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, combineImage string, i
|
|||
unityRenderBeginTime := time.Now().UTC().UnixMilli()
|
||||
_, err = curl.ApiCall(url, "POST", header, bytes.NewReader(postDataBytes), time.Second*10)
|
||||
if err != nil {
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "request unity api err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "request unity api err", 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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user