|
@@ -86,7 +86,7 @@ class SportOdds extends Command
|
|
|
//直播赔率(获取正在直播的所有赛事的赔率)
|
|
//直播赔率(获取正在直播的所有赛事的赔率)
|
|
|
if ($is_live == 1) {
|
|
if ($is_live == 1) {
|
|
|
$data = SportClientService::oddsLive([]);
|
|
$data = SportClientService::oddsLive([]);
|
|
|
- // file_put_contents("oddsLive.json",json_encode($data));
|
|
|
|
|
|
|
+ file_put_contents("oddsLive.json",json_encode($data));
|
|
|
$this->updateOddsLive($data);
|
|
$this->updateOddsLive($data);
|
|
|
} else {
|
|
} else {
|
|
|
//普通球赛是开赛前购买,更新数据
|
|
//普通球赛是开赛前购买,更新数据
|
|
@@ -119,22 +119,42 @@ class SportOdds extends Command
|
|
|
'is_send' => 0,
|
|
'is_send' => 0,
|
|
|
'is_roll' => 1,
|
|
'is_roll' => 1,
|
|
|
'is_locked' => 0,
|
|
'is_locked' => 0,
|
|
|
|
|
+ 'odds' => $odds
|
|
|
];
|
|
];
|
|
|
- $fixture_status = null;
|
|
|
|
|
|
|
+ $odd_fixture_status = null;//直播赔率中的赛事时间和状态(与直播赛事信息中的赛事时间和状态存在较大差异)
|
|
|
if (isset($item['fixture']['status']['long']) ) {
|
|
if (isset($item['fixture']['status']['long']) ) {
|
|
|
$long = $item['fixture']['status']['long'];
|
|
$long = $item['fixture']['status']['long'];
|
|
|
if (isset($this->fixture_status[$long])) {
|
|
if (isset($this->fixture_status[$long])) {
|
|
|
- $fixture_status = json_encode($item['fixture']['status']);
|
|
|
|
|
- $update_data['fixture_status'] = $fixture_status;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $sport_info = SportModel::where('data_id',$data_id)->first();
|
|
|
|
|
+ $fixture_status = $sport_info['fixture_status'] ? json_decode($sport_info['fixture_status'],true) : [];
|
|
|
|
|
+
|
|
|
|
|
+ $odd_fixture_status = $item['fixture']['status'];
|
|
|
|
|
+ $update_data['odd_fixture_status'] = json_encode($odd_fixture_status);
|
|
|
|
|
+
|
|
|
|
|
+ //如果时间差距超过3分钟,则锁盘,不超过3分钟就解锁
|
|
|
|
|
+ if (isset($fixture_status['elapsed']) && isset($odd_fixture_status['elapsed'])) {
|
|
|
|
|
+ if (abs($fixture_status['elapsed'] - $odd_fixture_status['elapsed']) > 3) {
|
|
|
|
|
+ $odds = $sport_info['odds'] ? json_decode($sport_info['odds'],true) : null;
|
|
|
|
|
+ $odds_ids = [];
|
|
|
|
|
+ foreach($odds as $odd) {
|
|
|
|
|
+ $odds_ids[] = $odd['id'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $update_data['odd_ids_locked'] = json_encode($odds_ids);
|
|
|
|
|
+ unset($update_data['odds']);//不更新赔率
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $update_data['odd_ids_locked'] = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (isset($this->long_status[$long])) {
|
|
|
|
|
- $update_data['state'] = $this->long_status[$long];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($item['teams']['home']['goals'])) {
|
|
|
|
|
- $update_data['score'] = $item['teams']['home']['goals'] ."-". $item['teams']['away']['goals'];
|
|
|
|
|
|
|
+ // if (isset($this->long_status[$long])) {
|
|
|
|
|
+ // $update_data['state'] = $this->long_status[$long];
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
+ // if (isset($item['teams']['home']['goals'])) {
|
|
|
|
|
+ // $update_data['score'] = $item['teams']['home']['goals'] ."-". $item['teams']['away']['goals'];
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
//锁盘
|
|
//锁盘
|
|
|
if (isset($item['fixture']['status']['blocked']) && $item['fixture']['status']['blocked']) {
|
|
if (isset($item['fixture']['status']['blocked']) && $item['fixture']['status']['blocked']) {
|
|
@@ -156,7 +176,6 @@ class SportOdds extends Command
|
|
|
$update_data['refund_status'] = 1;
|
|
$update_data['refund_status'] = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $update_data['odds'] = $odds;
|
|
|
|
|
SportModel::where('data_id',$data_id)->update($update_data);
|
|
SportModel::where('data_id',$data_id)->update($update_data);
|
|
|
// echo $data_id.": 更新成功\r\n";
|
|
// echo $data_id.": 更新成功\r\n";
|
|
|
}
|
|
}
|