mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 21:40:50 +00:00
fix(订单中台): 用户取消订单补写中台取消时间
用户端 cancelOrder 此前仅翻转 status_code,中台表 cancel_time 一直为 0,与超时自动取消(UnpaidOrderCancelJob 补写 cancel_time) 口径不一致。取消事务内随状态一并写入,保证两字段原子落库。
This commit is contained in:
parent
9a494d4db3
commit
76146a9483
@ -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('取消失败');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user