From 600a6edd7b26ebaad6337a8791cf796a9c48fad1 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 26 Sep 2023 13:06:51 +0800 Subject: [PATCH] fix --- .../product/internal/logic/calculateproductpricelogic.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/product/internal/logic/calculateproductpricelogic.go b/server/product/internal/logic/calculateproductpricelogic.go index 2da76ec1..0e0e3309 100644 --- a/server/product/internal/logic/calculateproductpricelogic.go +++ b/server/product/internal/logic/calculateproductpricelogic.go @@ -73,10 +73,13 @@ func (l *CalculateProductPriceLogic) CalculateProductPrice(req *types.CalculateP fittingPrice := int64(0) if req.FittingId > 0 { fittingInfo, err := l.svcCtx.AllModels.FsProductModel3d.FindOne(l.ctx, req.FittingId, "id,price") - if errors.Is(err, gorm.ErrRecordNotFound) { - return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "fitting info is not exists") + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "fitting info is not exists") + } + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get fitting info") } - return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get fitting info") fittingPrice = *fittingInfo.Price } totalPrice, itemPrice, err := step_price.GetNewCentStepPrice(req.PurchaseQuantity, stepPrice, fittingPrice)