|
|
@@ -115,18 +115,28 @@ class Sport extends Command
|
|
|
//进行中超过3分钟没有更新数据的赛事,检查比赛是否结束
|
|
|
public function checkLiveFixtures()
|
|
|
{
|
|
|
- //统一锁盘时间(比赛开始前1分钟)
|
|
|
+ //体育赛事结束前几(分钟)锁盘,90分钟结束
|
|
|
+ $sport_locked = Config::where('field', 'sport_locked')->first()->val ?? 1;
|
|
|
+
|
|
|
+ //1. 统一锁盘时间(比赛开始前1分钟)
|
|
|
SportModel::where(['is_locked' => 0, 'is_roll' => 0])->where('game_time', '<=', time() - 60)->update(['is_locked' => 1]);
|
|
|
|
|
|
+ //2. 比赛开始后,状态还是未开始的数据检测
|
|
|
+ $ids = SportModel::where('status', 1)->where('state', 0)->where('game_time', '>=', time())->pluck('data_id')->toArray();
|
|
|
+ if ($ids) {
|
|
|
+ $ids = implode('-', $ids);
|
|
|
+ $data = SportClientService::fixtures(['ids' => $ids]);
|
|
|
+ $this->updateOrCreateSport($data, $sport_locked, 1);
|
|
|
+ }
|
|
|
|
|
|
- //体育赛事结束前几(分钟)锁盘,90分钟结束
|
|
|
- $sport_locked = Config::where('field', 'sport_locked')->first()->val ?? 1;
|
|
|
+ //3. 比赛进行中,超过3分钟未更新的数据检测
|
|
|
$end_time = date("Y-m-d H:i:s", time() - 180);
|
|
|
$ids = SportModel::where('status', 1)->where('state', 1)->where('updated_at', '<=', $end_time)->pluck('data_id')->toArray();
|
|
|
- $ids = implode('-', $ids);
|
|
|
-
|
|
|
- $data = SportClientService::fixtures(['ids' => $ids]);
|
|
|
- $this->updateOrCreateSport($data, $sport_locked, 1);
|
|
|
+ if ($ids) {
|
|
|
+ $ids = implode('-', $ids);
|
|
|
+ $data = SportClientService::fixtures(['ids' => $ids]);
|
|
|
+ $this->updateOrCreateSport($data, $sport_locked, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//更新进行中的赛事
|