This commit is contained in:
laodaming 2023-09-26 13:06:51 +08:00
parent e23ee6518d
commit 600a6edd7b

View File

@ -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)