onQueue('order_handle'); $this->order = Order::where('trade_no', $tradeNo) ->lockForUpdate() ->first(); } /** * Execute the job. * * @return void */ public function handle() { if (!$this->order) return; $orderService = new OrderService($this->order); switch ($this->order->status) { // cancel case 0: if ($this->order->created_at <= (time() - 1800)) { $orderService->cancel(); } break; case 1: $orderService->open(); break; } } }