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