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