fix: 创建订单时设置30分钟支付过期时间
Build and Push Docker Image / build-and-push (push) Successful in 1m3s
Build and Push Docker Image / deploy (push) Successful in 10s

This commit is contained in:
2026-07-14 12:18:41 +00:00
parent 0a0f10b086
commit 0669528e58
2 changed files with 7 additions and 65 deletions
+7
View File
@@ -176,6 +176,12 @@ func checkOrdersExpired(orders []models.Order) {
}
}
// getPaymentExpiryTime 获取支付过期时间(当前时间 + 30分钟)
func getPaymentExpiryTime() *time.Time {
t := time.Now().Add(30 * time.Minute)
return &t
}
func (h *OrderHandler) List(c *gin.Context) {
userID := c.GetUint("user_id")
role, _ := c.Get("role")
@@ -401,6 +407,7 @@ func (h *OrderHandler) Create(c *gin.Context) {
Status: models.OrderStatusPendingPayment,
ShippingAddressID: &req.ShippingAddressID,
PaymentMethod: req.PaymentMethod,
PaymentExpiresAt: getPaymentExpiryTime(),
}
tx := utils.DB.Begin()