autoCancel(); return $this; } public function autoCancel() { $config = \Yii::$app->params; $orderAutoCancelMinute = isset($config['order']['over_time']) ? $config['order']['over_time'] : 900; if (is_numeric($orderAutoCancelMinute) && $orderAutoCancelMinute >= 0) { // 订单自动取消任务 \Yii::$app->queue->delay($orderAutoCancelMinute)->push(new OrderCancelJob([ 'orderId' => $this->event->order->id, ])); $autoCancelTime = $this->event->order->created_at + $orderAutoCancelMinute; $this->event->order->auto_cancel_time = $autoCancelTime; $this->event->order->save(); } return $this; } }