fix: BepUsdt请求体amount改为float64数字类型,修复订单表格宽度

This commit is contained in:
2026-05-28 00:12:18 +08:00
parent 632fff3b49
commit cd24e88f60
3 changed files with 32 additions and 15 deletions
+19 -2
View File
@@ -25,6 +25,15 @@ func NewPaymentHandler() *PaymentHandler {
return &PaymentHandler{}
}
type BepUsdtCreateRequest struct {
TradeType string `json:"trade_type,omitempty"`
OrderID string `json:"order_id"`
Amount float64 `json:"amount"`
NotifyURL string `json:"notify_url"`
RedirectURL string `json:"redirect_url,omitempty"`
Signature string `json:"signature"`
}
func (h *PaymentHandler) CreatePayment(c *gin.Context) {
userID := c.GetUint("user_id")
orderID, _ := strconv.Atoi(c.Param("id"))
@@ -78,12 +87,20 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
}
signature := signBepUsdt(params, apiToken)
params["signature"] = signature
log.Printf("[BepUsdt] signature params: %v", params)
log.Printf("[BepUsdt] signature: %s, token: %s", signature, apiToken)
body, _ := json.Marshal(params)
reqBody := BepUsdtCreateRequest{
TradeType: tradeType,
OrderID: strconv.Itoa(int(order.ID)),
Amount: order.TotalAmount,
NotifyURL: notifyURL,
RedirectURL: redirectURL,
Signature: signature,
}
body, _ := json.Marshal(reqBody)
log.Printf("[BepUsdt] request body: %s", string(body))
req, err := http.NewRequest("POST", apiURL+"/api/v1/order/create-transaction", strings.NewReader(string(body)))