|
@@ -297,7 +297,7 @@ class Sport extends Command
|
|
|
'score' => isset($item['score']['fulltime']) ? "{$item['score']['fulltime']['home']}-{$item['score']['fulltime']['away']}":'-',
|
|
'score' => isset($item['score']['fulltime']) ? "{$item['score']['fulltime']['home']}-{$item['score']['fulltime']['away']}":'-',
|
|
|
'league' => lang($item['league']['name']),
|
|
'league' => lang($item['league']['name']),
|
|
|
'league_en' => $item['league']['name'],
|
|
'league_en' => $item['league']['name'],
|
|
|
- 'state' => $status[$item['fixture']['status']['short']],//比赛状态:0未开始1进行中2已完场3延期4取消
|
|
|
|
|
|
|
+ // 'state' => $status[$item['fixture']['status']['short']],//比赛状态:0未开始1进行中2已完场3延期4取消
|
|
|
'game_time' => $item['fixture']['timestamp'],
|
|
'game_time' => $item['fixture']['timestamp'],
|
|
|
'status' => 1,
|
|
'status' => 1,
|
|
|
'updated_at' => now(),
|
|
'updated_at' => now(),
|
|
@@ -305,6 +305,10 @@ class Sport extends Command
|
|
|
'away_statistics' => $away_statistics,
|
|
'away_statistics' => $away_statistics,
|
|
|
'is_send' => 0,
|
|
'is_send' => 0,
|
|
|
];
|
|
];
|
|
|
|
|
+ $status_short = strtoupper($item['fixture']['status']['short']);
|
|
|
|
|
+ if (isset($status[$status_short])) {
|
|
|
|
|
+ $sport_data['state'] = $status[$status_short];
|
|
|
|
|
+ }
|
|
|
$sport_data['score'] = $sport_data['score'] == '-' ? '' : $sport_data['score'];
|
|
$sport_data['score'] = $sport_data['score'] == '-' ? '' : $sport_data['score'];
|
|
|
$sport_data['half_score'] = $sport_data['half_score'] == '-' ? '' : $sport_data['half_score'];
|
|
$sport_data['half_score'] = $sport_data['half_score'] == '-' ? '' : $sport_data['half_score'];
|
|
|
|
|
|
|
@@ -320,7 +324,7 @@ class Sport extends Command
|
|
|
SportModel::addSportLeague($item['league']);
|
|
SportModel::addSportLeague($item['league']);
|
|
|
|
|
|
|
|
//比赛结束,插入比赛事件
|
|
//比赛结束,插入比赛事件
|
|
|
- if ($sport_data['state'] == 2 && !empty($item['events'])) {
|
|
|
|
|
|
|
+ if (isset($sport_data['state']) && $sport_data['state'] == 2 && !empty($item['events'])) {
|
|
|
foreach($item['events'] as $event) {
|
|
foreach($item['events'] as $event) {
|
|
|
SportEvent::create([
|
|
SportEvent::create([
|
|
|
'data_id' => $item['fixture']['id'],
|
|
'data_id' => $item['fixture']['id'],
|
|
@@ -359,8 +363,12 @@ class Sport extends Command
|
|
|
foreach($odds as $odd) {
|
|
foreach($odds as $odd) {
|
|
|
$odd_id = $odd['id'];
|
|
$odd_id = $odd['id'];
|
|
|
$odd_name = $odd['name'];
|
|
$odd_name = $odd['name'];
|
|
|
- $info = DB::table('sport_odds')->where('odd_name_en',$odd_name)->first();
|
|
|
|
|
- if (!$info) {
|
|
|
|
|
|
|
+ $info = DB::table('sport_odds')->where('odd_id',$odd_id)->where('odd_name_en',$odd_name)->first();
|
|
|
|
|
+ if ($info && (!$info->odd_name || $odd_name != $info->odd_name_en)) {
|
|
|
|
|
+ DB::table('sport_odds')->where('id', $info->id)->update([
|
|
|
|
|
+ 'odd_name_en' => $odd_name,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ } elseif (!$info) {
|
|
|
DB::table('sport_odds')->insert([
|
|
DB::table('sport_odds')->insert([
|
|
|
'odd_id' => $odd_id,
|
|
'odd_id' => $odd_id,
|
|
|
'odd_name_en' => $odd_name,
|
|
'odd_name_en' => $odd_name,
|