Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-08-29 10:34:23 +08:00
commit 74581a1a1a
2 changed files with 10 additions and 10 deletions

View File

@ -117,7 +117,7 @@ func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Co
func (t *FsProductTemplateV2Model) FindFirstOneCloudRenderByProductIdModelIdTemplateTag(ctx context.Context, productId, modelId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
Where("product_id = ? and model_id = ? and template_tag = ? ", productId, modelId, templateTag).
Where("status = ? and is_del = ? ", 1, 0).
Where("status = ? and is_del = ? and element_model_id != ?", 1, 0, 0).
Order("sort ASC").
Take(&resp).Error
return resp, err

View File

@ -147,14 +147,14 @@ func (w *wsConnectItem) consumeRenderCache(data []byte) {
return
}
//获取渲染设置信息
element, err := w.logic.svcCtx.AllModels.FsProductTemplateElement.FindOneByModelId(w.logic.ctx, *productTemplate.ModelId)
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, productFirstSize.Id, 0)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "render element is not exists", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.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, productFirstSize.Id, 0)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to get render element", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
logx.Error("failed to get element ,", err)
return
}
@ -171,7 +171,7 @@ func (w *wsConnectItem) consumeRenderCache(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, productFirstSize.Id, 0)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "failed to combine image:"+err.Error(), w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
logx.Error("合成刀版图失败,合成请求数据:", combineReq, "错误信息:", err)
return
}
@ -179,7 +179,7 @@ func (w *wsConnectItem) consumeRenderCache(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, productFirstSize.Id, 0)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "combine image is empty", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
logx.Error("合成刀版图失败,合成的刀版图是空指针:", err)
return
}
@ -199,7 +199,7 @@ func (w *wsConnectItem) consumeRenderCache(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, productFirstSize.Id, 0)
w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, taskId, "failed to get render cache", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
logx.Error("failed to find render resource:", err)
return
}
@ -271,7 +271,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, productFirstSize.Id, 0)
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Refletion from string to number err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
return err
}
}
@ -280,7 +280,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, productFirstSize.Id, 0)
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "parse element.Mode err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
return err
}
}
@ -353,7 +353,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, productFirstSize.Id, 0)
w.renderErrResponse(info.RenderId, info.RenderData.TemplateTag, taskId, "request unity api err", w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productFirstSize.Id, *productTemplate.ElementModelId)
logx.Error("failed to send data to unity")
return err
}