fix: 收银台金额和二维码修复-提取payment_url用于二维码和支付链接

This commit is contained in:
2026-05-28 01:40:54 +08:00
parent 65965c409f
commit 175022a3fd
2 changed files with 55 additions and 18 deletions
+15 -1
View File
@@ -141,10 +141,23 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
tradeID, _ := data["trade_id"].(string)
token, _ := data["token"].(string)
paymentURL, _ := data["payment_url"].(string)
var amount float64
if v, ok := data["amount"].(float64); ok {
amount = v
} else if v, ok := data["amount"].(string); ok {
amount, _ = strconv.ParseFloat(v, 64)
}
var actualAmount float64
if v, ok := data["actual_amount"].(float64); ok {
actualAmount = v
} else if v, ok := data["actual_amount"].(string); ok {
actualAmount, _ = strconv.ParseFloat(v, 64)
}
if actualAmount == 0 {
actualAmount = amount
}
var expiration int64
@@ -170,9 +183,10 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
paymentInfo := map[string]interface{}{
"trade_id": tradeID,
"order_id": order.ID,
"amount": data["amount"],
"amount": amount,
"actual_amount": actualAmount,
"token": token,
"payment_url": paymentURL,
"expiration_time": remainingSeconds,
"trade_type": tradeType,
"channel_id": channel.ID,