onQueue('stat_server'); $this->statistic = $statistic; } /** * Execute the job. * * @return void */ public function handle() { $statistic = $this->statistic; $data = StatServer::where('record_at', $statistic['record_at']) ->where('server_id', $statistic['server_id']) ->first(); if ($data) { try { $data->update($statistic); } catch (\Exception $e) { abort(500, '节点统计数据更新失败'); } } else { if (!StatServer::create($statistic)) { abort(500, '节点统计数据创建失败'); } } } }