From e6c0558679bcba0c0d76a33fa2c63802de49d4da Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 8 Sep 2023 18:52:57 +0800 Subject: [PATCH] fix --- model/gmodel/fs_product_template_v2_logic.go | 2 +- server/websocket/internal/logic/ws_render_image.go | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/model/gmodel/fs_product_template_v2_logic.go b/model/gmodel/fs_product_template_v2_logic.go index bb657017..c99314d1 100755 --- a/model/gmodel/fs_product_template_v2_logic.go +++ b/model/gmodel/fs_product_template_v2_logic.go @@ -116,7 +116,7 @@ func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Co // 获取开启云渲染模板 func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdModelIdTemplateTag(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("product_id = ? and model_id = ? and template_tag = ? and element_model_id > ? ", productId, modelId, templateTag, 0). Where("status = ? and is_del = ?", 1, 0). Order("sort ASC"). Take(&resp).Error diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 1b47d116..d1cc0405 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -278,7 +278,7 @@ func (w *wsConnectItem) getProductRelateionInfo(renderImageData websocket_data.R productTemplate, err = w.logic.svcCtx.AllModels.FsProductTemplateV2.FindOneCloudRenderByProductIdModelIdTemplateTag(w.logic.ctx, renderImageData.RenderData.ProductId, model3d.Id, renderImageData.RenderData.TemplateTag) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { - w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "找不到对应的模板", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, model3d.Id, productSize.Id, 0) + w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "找不到对应开启云渲染的模板", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, model3d.Id, productSize.Id, 0) logx.Error("template info is not found") return nil, nil, nil, err } @@ -286,10 +286,6 @@ func (w *wsConnectItem) getProductRelateionInfo(renderImageData websocket_data.R logx.Error("failed to get template info:", err) return nil, nil, nil, err } - if *productTemplate.ElementModelId <= 0 { - w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "模板未开启云渲染", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3d.Id, productSize.Id, 0) - return nil, nil, nil, errors.New("模板未开启云渲染") - } if productTemplate.TemplateInfo == nil || *productTemplate.TemplateInfo == "" { w.renderErrResponse(renderImageData.RenderId, renderImageData.RenderData.TemplateTag, "", "渲染模板的json设计信息是空的", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3d.Id, productSize.Id, 0) return nil, nil, nil, errors.New("渲染模板的json设计信息是空的")