onQueue('traffic_fetch'); $this->u = $u; $this->d = $d; $this->userId = $userId; $this->server = $server; $this->protocol = $protocol; } /** * Execute the job. * * @return void */ public function handle() { $user = User::find($this->userId); if (!$user) return; try { $user->update([ 't' => time(), 'u' => DB::raw("u+{$this->u}"), 'd' => DB::raw("d+{$this->d}") ]); } catch (\Exception $e) { throw new \Exception('流量更新失败'); } $mailService = new MailService(); $mailService->remindTraffic($user->first()); } }