From 76146a9483bd411b7ff800aa11a1b2e1d60dce51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Fri, 9 Oct 2026 10:33:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=AE=A2=E5=8D=95=E4=B8=AD=E5=8F=B0):=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95=E8=A1=A5?= =?UTF-8?q?=E5=86=99=E4=B8=AD=E5=8F=B0=E5=8F=96=E6=B6=88=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户端 cancelOrder 此前仅翻转 status_code,中台表 cancel_time 一直为 0,与超时自动取消(UnpaidOrderCancelJob 补写 cancel_time) 口径不一致。取消事务内随状态一并写入,保证两字段原子落库。 --- backend/app/services/order/OrderCenterUserServices.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/services/order/OrderCenterUserServices.php b/backend/app/services/order/OrderCenterUserServices.php index 1fb713f9e..70d969d37 100644 --- a/backend/app/services/order/OrderCenterUserServices.php +++ b/backend/app/services/order/OrderCenterUserServices.php @@ -435,8 +435,9 @@ class OrderCenterUserServices extends OrderCenterServices $order = $this->dao->getByIdForUpdate((int)$order['id']); if ((int)$order['pay_status'] !== 0) throw new ApiException('订单已经支付无法取消'); if ($order['status_code'] === OrderCenter::STATUS_CANCELED) return; - // 修改订单状态为已取消 + // 修改订单状态为已取消,同时记录取消时间(与超时自动取消的 cancel_time 口径一致) $order->status_code = OrderCenter::STATUS_CANCELED; + $order->cancel_time = time(); if (!$order->save()) { throw new ApiException('取消失败'); }