fix: 回退签名修改,保留钱包地址获取增强

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 20:22:05 +08:00
parent 1b86cce92b
commit 55b1ced510
+3 -6
View File
@@ -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,