wip
This commit is contained in:
1 parent
7c19b9d3ee
commit
9954f47139
2 files changed
+45
-34
No files matched your search
+5
@@ -90,6 +90,11 @@ class StatistikoEventsTable
|
|||||||
if (!$data['sport_id']) {
|
if (!$data['sport_id']) {
|
||||||
$data['sport_id'] = 1;
|
$data['sport_id'] = 1;
|
||||||
}
|
}
|
||||||
|
StatistikoEvent::where('exp_home', 0)->delete();
|
||||||
|
StatistikoEvent::where('exp_away', 0)->delete();
|
||||||
|
StatistikoEvent::where('exp_handicap', 0)->delete();
|
||||||
|
StatistikoEvent::where('exp_total', 0)->delete();
|
||||||
|
|
||||||
$events = StatistikoEvent::where('sport_id', (int) $data['sport_id'])->pluck('match_id')->toArray();
|
$events = StatistikoEvent::where('sport_id', (int) $data['sport_id'])->pluck('match_id')->toArray();
|
||||||
$doublEvents = array_diff_assoc(
|
$doublEvents = array_diff_assoc(
|
||||||
$events,
|
$events,
|
||||||
|
|||||||
@@ -21,41 +21,47 @@ class ImportEvents
|
|||||||
foreach ($chunk as $row) {
|
foreach ($chunk as $row) {
|
||||||
|
|
||||||
$row = array_values($row);
|
$row = array_values($row);
|
||||||
|
/**
|
||||||
|
* must be != null
|
||||||
|
* exp_home, exp_away, exp_handicap, exp_total
|
||||||
|
*/
|
||||||
|
if ((float) $row[21] != 0 && (float) $row[22] != 0 && (float) $row[23] != 0) {
|
||||||
|
|
||||||
StatistikoEvent::updateOrCreate(
|
StatistikoEvent::updateOrCreate(
|
||||||
[
|
[
|
||||||
'match_id' => (int) $row[0],
|
'match_id' => (int) $row[0],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'sport_id' => (int) $row[1],
|
'sport_id' => (int) $row[1],
|
||||||
'league_id' => (int) $row[2],
|
'league_id' => (int) $row[2],
|
||||||
'home_id' => (int) $row[3],
|
'home_id' => (int) $row[3],
|
||||||
'away_id' => (int) $row[4],
|
'away_id' => (int) $row[4],
|
||||||
'starttime' => Carbon::parse($row[5])->toIso8601String(),
|
'starttime' => Carbon::parse($row[5])->toIso8601String(),
|
||||||
'season' => (string) $row[6],
|
'season' => (string) $row[6],
|
||||||
'gls_h' => (int) $row[7],
|
'gls_h' => (int) $row[7],
|
||||||
'gls_a' => (int) $row[8],
|
'gls_a' => (int) $row[8],
|
||||||
'crn_h' => (int) $row[9],
|
'crn_h' => (int) $row[9],
|
||||||
'crn_a' => (int) $row[10],
|
'crn_a' => (int) $row[10],
|
||||||
'fls_h' => (int) $row[11],
|
'fls_h' => (int) $row[11],
|
||||||
'fls_a' => (int) $row[12],
|
'fls_a' => (int) $row[12],
|
||||||
'ofs_h' => (int) $row[13],
|
'ofs_h' => (int) $row[13],
|
||||||
'ofs_a' => (int) $row[14],
|
'ofs_a' => (int) $row[14],
|
||||||
'snt_h' => (int) $row[15],
|
'snt_h' => (int) $row[15],
|
||||||
'snt_a' => (int) $row[16],
|
'snt_a' => (int) $row[16],
|
||||||
'tsh_h' => (int) $row[17],
|
'tsh_h' => (int) $row[17],
|
||||||
'tsh_a' => (int) $row[18],
|
'tsh_a' => (int) $row[18],
|
||||||
'crd_h' => (int) $row[19],
|
'crd_h' => (int) $row[19],
|
||||||
'crd_a' => (int) $row[20],
|
'crd_a' => (int) $row[20],
|
||||||
'exp_home' => (float) $row[21],
|
'exp_home' => (float) $row[21],
|
||||||
'exp_away' => (float) $row[22],
|
'exp_away' => (float) $row[22],
|
||||||
'exp_handicap' => (float) $row[23],
|
'exp_handicap' => (float) $row[23],
|
||||||
'exp_total' => (float) $row[24],
|
'exp_total' => (float) $row[24],
|
||||||
'result_code' => $row[25], // w, d, l
|
'result_code' => $row[25], // w, d, l
|
||||||
'created_at' => $now,
|
'created_at' => $now,
|
||||||
'updated_at' => $now,
|
'updated_at' => $now,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user