fix: BepUsdt请求体amount改为float64数字类型,修复订单表格宽度
This commit is contained in:
@@ -25,6 +25,15 @@ func NewPaymentHandler() *PaymentHandler {
|
|||||||
return &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) {
|
func (h *PaymentHandler) CreatePayment(c *gin.Context) {
|
||||||
userID := c.GetUint("user_id")
|
userID := c.GetUint("user_id")
|
||||||
orderID, _ := strconv.Atoi(c.Param("id"))
|
orderID, _ := strconv.Atoi(c.Param("id"))
|
||||||
@@ -78,12 +87,20 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
signature := signBepUsdt(params, apiToken)
|
signature := signBepUsdt(params, apiToken)
|
||||||
params["signature"] = signature
|
|
||||||
|
|
||||||
log.Printf("[BepUsdt] signature params: %v", params)
|
log.Printf("[BepUsdt] signature params: %v", params)
|
||||||
log.Printf("[BepUsdt] signature: %s, token: %s", signature, apiToken)
|
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))
|
log.Printf("[BepUsdt] request body: %s", string(body))
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", apiURL+"/api/v1/order/create-transaction", strings.NewReader(string(body)))
|
req, err := http.NewRequest("POST", apiURL+"/api/v1/order/create-transaction", strings.NewReader(string(body)))
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="table-card">
|
<div class="table-card">
|
||||||
<el-table :data="paginatedOrders" style="width: 100%">
|
<el-table :data="paginatedOrders" style="width: 100%">
|
||||||
<el-table-column prop="id" label="ID" width="80" />
|
<el-table-column prop="id" label="ID" width="70" />
|
||||||
<el-table-column prop="user.username" label="用户" min-width="120" />
|
<el-table-column prop="user.username" label="用户" min-width="100" />
|
||||||
<el-table-column prop="total_amount" label="金额" width="100"><template #default="{ row }">¥{{ row.total_amount }}</template></el-table-column>
|
<el-table-column prop="total_amount" label="金额" min-width="100"><template #default="{ row }">¥{{ row.total_amount }}</template></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" width="120"><template #default="{ row }"><el-tag>{{ statusText(row.status) }}</el-tag></template></el-table-column>
|
<el-table-column prop="status" label="状态" min-width="100"><template #default="{ row }"><el-tag>{{ statusText(row.status) }}</el-tag></template></el-table-column>
|
||||||
<el-table-column prop="refund_status" label="退款" width="100"><template #default="{ row }"><el-tag v-if="row.refund_status" type="warning">{{ row.refund_status }}</el-tag></template></el-table-column>
|
<el-table-column prop="refund_status" label="退款" min-width="80"><template #default="{ row }"><el-tag v-if="row.refund_status" type="warning">{{ row.refund_status }}</el-tag></template></el-table-column>
|
||||||
<el-table-column label="创建时间" width="180">
|
<el-table-column label="创建时间" min-width="160">
|
||||||
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
|
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" width="150" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button v-if="row.refund_status === 'pending'" link type="primary" size="small" @click="processRefund(row.id, 'approved')">批准</el-button>
|
<el-button v-if="row.refund_status === 'pending'" link type="primary" size="small" @click="processRefund(row.id, 'approved')">批准</el-button>
|
||||||
<el-button v-if="row.refund_status === 'pending'" link type="danger" size="small" @click="processRefund(row.id, 'rejected')">拒绝</el-button>
|
<el-button v-if="row.refund_status === 'pending'" link type="danger" size="small" @click="processRefund(row.id, 'rejected')">拒绝</el-button>
|
||||||
|
|||||||
@@ -2,20 +2,20 @@
|
|||||||
<div class="orders-page">
|
<div class="orders-page">
|
||||||
<BackNav />
|
<BackNav />
|
||||||
<div class="table-card">
|
<div class="table-card">
|
||||||
<el-table :data="orders">
|
<el-table :data="orders" style="width: 100%">
|
||||||
<el-table-column prop="id" label="ID" width="80" />
|
<el-table-column prop="id" label="ID" width="70" />
|
||||||
<el-table-column prop="total_amount" :label="$t('order.totalAmount')" width="120">
|
<el-table-column prop="total_amount" :label="$t('order.totalAmount')" min-width="100">
|
||||||
<template #default="{ row }">¥{{ row.total_amount }}</template>
|
<template #default="{ row }">¥{{ row.total_amount }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="status" :label="$t('order.status')" width="120">
|
<el-table-column prop="status" :label="$t('order.status')" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag :type="statusType(row.status)">{{ statusText(row.status) }}</el-tag>
|
<el-tag :type="statusType(row.status)">{{ statusText(row.status) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" width="180">
|
<el-table-column label="创建时间" min-width="160">
|
||||||
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
|
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="200">
|
<el-table-column label="操作" width="200" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link type="primary" size="small" @click="$router.push(`/orders/${row.id}`)">查看</el-button>
|
<el-button link type="primary" size="small" @click="$router.push(`/orders/${row.id}`)">查看</el-button>
|
||||||
<el-button v-if="row.status === 'pending_payment'" link type="success" size="small" @click="goPay(row)">去支付</el-button>
|
<el-button v-if="row.status === 'pending_payment'" link type="success" size="small" @click="goPay(row)">去支付</el-button>
|
||||||
|
|||||||
Reference in New Issue
Block a user