From 55b1ced5104c0240d29e0bcf64698b952e896151 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 30 May 2026 20:22:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=9E=E9=80=80=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BF=9D=E7=95=99=E9=92=B1=E5=8C=85?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E8=8E=B7=E5=8F=96=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- backend/internal/api/handlers/payment.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/internal/api/handlers/payment.go b/backend/internal/api/handlers/payment.go index e288e79..015850e 100644 --- a/backend/internal/api/handlers/payment.go +++ b/backend/internal/api/handlers/payment.go @@ -28,7 +28,7 @@ func NewPaymentHandler() *PaymentHandler { type BepUsdtCreateRequest struct { TradeType string `json:"trade_type,omitempty"` OrderID string `json:"order_id"` - Amount string `json:"amount"` + Amount float64 `json:"amount"` NotifyURL string `json:"notify_url"` RedirectURL string `json:"redirect_url,omitempty"` Signature string `json:"signature"` @@ -90,12 +90,9 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) { notifyURL := fmt.Sprintf("%s/api/payment/bepusdt/notify", baseURL) redirectURL := fmt.Sprintf("%s/orders/%d", baseURL, order.ID) - // 格式化amount,确保签名和请求中的格式一致 - amountStr := strconv.FormatFloat(order.TotalAmount, 'f', 2, 64) - params := map[string]string{ "order_id": strconv.Itoa(int(order.ID)), - "amount": amountStr, + "amount": fmt.Sprint(order.TotalAmount), "notify_url": notifyURL, "redirect_url": redirectURL, } @@ -111,7 +108,7 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) { reqBody := BepUsdtCreateRequest{ TradeType: tradeType, OrderID: strconv.Itoa(int(order.ID)), - Amount: amountStr, + Amount: order.TotalAmount, NotifyURL: notifyURL, RedirectURL: redirectURL, Signature: signature,