From 1dfa390557b54928e50dffc4519d54eb34d42b4b Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 16:16:33 +0800 Subject: [PATCH] fix --- model/gmodel/fs_product_model3d_logic.go | 5 ++--- .../product/internal/logic/getrecommandproductlistlogic.go | 1 + server/product/internal/logic/gettagproductlistlogic.go | 1 + .../internal/logic/homepagerecommendproductlistlogic.go | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/model/gmodel/fs_product_model3d_logic.go b/model/gmodel/fs_product_model3d_logic.go index c84373b1..7f399a01 100755 --- a/model/gmodel/fs_product_model3d_logic.go +++ b/model/gmodel/fs_product_model3d_logic.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "fusenapi/constants" - "github.com/zeromicro/go-zero/core/logx" "sort" ) @@ -186,11 +185,11 @@ func (d *FsProductModel3dModel) GetProductMinPrice(ctx context.Context, productI switch *modelInfo.Tag { case constants.TAG_MODEL: //模型 if modelInfo.StepPrice == nil || len(*modelInfo.StepPrice) == 0 { - return errors.New(fmt.Sprintf("model step price is not set:%d", modelInfo.Id)) + mapModelMinPrice[modelInfo.Id] = 0 + continue } var stepPrice StepPriceJsonStruct if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil { - logx.Error(err) return errors.New(fmt.Sprintf("failed to parse model step price:%d", modelInfo.Id)) } lenRange := len(stepPrice.PriceRange) diff --git a/server/product/internal/logic/getrecommandproductlistlogic.go b/server/product/internal/logic/getrecommandproductlistlogic.go index b65c3cb1..24721e95 100644 --- a/server/product/internal/logic/getrecommandproductlistlogic.go +++ b/server/product/internal/logic/getrecommandproductlistlogic.go @@ -94,6 +94,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec //获取产品最低价 mapProductMinPrice := make(map[int64]int64) if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, mapProductMinPrice); err != nil { + logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product min price") } //获取产品标签相关属性 diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index fdc951e6..a3861e39 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -229,6 +229,7 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn } //获取产品最低价格 if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, req.MapProductMinPrice); err != nil { + logx.Error(err) return nil, errors.New("failed to get product min price") } //获取模板 diff --git a/server/product/internal/logic/homepagerecommendproductlistlogic.go b/server/product/internal/logic/homepagerecommendproductlistlogic.go index eeb5726b..a4447811 100644 --- a/server/product/internal/logic/homepagerecommendproductlistlogic.go +++ b/server/product/internal/logic/homepagerecommendproductlistlogic.go @@ -114,6 +114,7 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty //获取产品最低价格 mapProductMinPrice := make(map[int64]int64) if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, mapProductMinPrice); err != nil { + logx.Error(err) return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product min price") } //获取模板(只是获取产品product_id)