From 6fba1d683a1064368939091d7deca05de1a3950a Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Tue, 2 Dec 2025 02:35:05 -0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=94=AF=E4=BB=98):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97=E7=B2=BE=E5=BA=A6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在epayPayment和CryptoSaaSPayment方法中,对转换后的金额进行四舍五入保留两位小数处理,确保支付金额精度准确 --- .../public/portal/purchaseCheckoutLogic.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/logic/public/portal/purchaseCheckoutLogic.go b/internal/logic/public/portal/purchaseCheckoutLogic.go index 7fa5827..a132acb 100644 --- a/internal/logic/public/portal/purchaseCheckoutLogic.go +++ b/internal/logic/public/portal/purchaseCheckoutLogic.go @@ -271,10 +271,11 @@ func (l *PurchaseCheckoutLogic) epayPayment(config *payment.Payment, info *order client := epay.NewClient(epayConfig.Pid, epayConfig.Url, epayConfig.Key, epayConfig.Type) // Convert order amount to CNY using current exchange rate - amount, err := l.queryExchangeRate("CNY", info.Amount) - if err != nil { - return "", err - } + amount, err := l.queryExchangeRate("CNY", info.Amount) + if err != nil { + return "", err + } + amount = math.Round(amount*100) / 100 // Build notification URL for payment status callbacks notifyUrl := "" @@ -313,10 +314,11 @@ func (l *PurchaseCheckoutLogic) CryptoSaaSPayment(config *payment.Payment, info client := epay.NewClient(epayConfig.AccountID, epayConfig.Endpoint, epayConfig.SecretKey, epayConfig.Type) // Convert order amount to CNY using current exchange rate - amount, err := l.queryExchangeRate("CNY", info.Amount) - if err != nil { - return "", err - } + amount, err := l.queryExchangeRate("CNY", info.Amount) + if err != nil { + return "", err + } + amount = math.Round(amount*100) / 100 // Build notification URL for payment status callbacks notifyUrl := ""