From 9bdaa75514f636c4da422fd782dbb619bd84f61c Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 27 Oct 2023 15:31:23 +0800 Subject: [PATCH] fix --- server/product/internal/logic/calculateproductpricelogic.go | 4 ++-- .../shopping-cart/internal/logic/calculatecartpricelogic.go | 6 +++--- server/shopping-cart/internal/logic/getcartslogic.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/product/internal/logic/calculateproductpricelogic.go b/server/product/internal/logic/calculateproductpricelogic.go index ed2886b3..d3de1ed7 100644 --- a/server/product/internal/logic/calculateproductpricelogic.go +++ b/server/product/internal/logic/calculateproductpricelogic.go @@ -113,8 +113,8 @@ func (l *CalculateProductPriceLogic) CalculateProductPrice(req *types.CalculateP return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to calculate product price ") } return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateProductPriceRsp{ - ItemPrice: format.CentitoDollar(itemPrice, 3), - TotalPrice: format.CentitoDollarWithNoHalfAdjust(totalPrice, 2), + ItemPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollar(itemPrice, 3)), + TotalPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollarWithNoHalfAdjust(totalPrice, 2)), StepRange: stepRange, }) } diff --git a/server/shopping-cart/internal/logic/calculatecartpricelogic.go b/server/shopping-cart/internal/logic/calculatecartpricelogic.go index 826728c2..0ace472b 100644 --- a/server/shopping-cart/internal/logic/calculatecartpricelogic.go +++ b/server/shopping-cart/internal/logic/calculatecartpricelogic.go @@ -126,8 +126,8 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri } calculateResultList = append(calculateResultList, types.CalculateResultItem{ CartId: cart.Id, - ItemPrice: format.CentitoDollar(itemPrice, 3), - TotalPrice: format.CentitoDollarWithNoHalfAdjust(totalPrice, 2), + ItemPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollar(itemPrice, 3)), + TotalPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollarWithNoHalfAdjust(totalPrice, 2)), }) updData := &gmodel.FsShoppingCart{ PurchaseQuantity: &reqPurchaseQuantity, @@ -150,7 +150,7 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri return resp.SetStatusWithMessage(basic.CodeDbSqlErr, err.Error()) } return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateCartPriceRsp{ - SubTotalPrice: format.CentitoDollarWithNoHalfAdjust(subTotalPrice, 2), + SubTotalPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollarWithNoHalfAdjust(subTotalPrice, 2)), CalculateResultList: calculateResultList, }) } diff --git a/server/shopping-cart/internal/logic/getcartslogic.go b/server/shopping-cart/internal/logic/getcartslogic.go index b9638b8a..464886f2 100644 --- a/server/shopping-cart/internal/logic/getcartslogic.go +++ b/server/shopping-cart/internal/logic/getcartslogic.go @@ -185,8 +185,8 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo FittingId: *cart.FittingId, FittingName: fittingName, }, - ItemPrice: format.CentitoDollar(itemPrice, 3), - TotalPrice: format.CentitoDollarWithNoHalfAdjust(totalPrice, 2), + ItemPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollar(itemPrice, 3)), + TotalPrice: format.NumToStringWithThousandthPercentile(format.CentitoDollarWithNoHalfAdjust(totalPrice, 2)), DiyInformation: types.DiyInformation{ Phone: snapShot.UserDiyInformation.Phone, Address: snapShot.UserDiyInformation.Address,