wip
This commit is contained in:
1 parent
c4569196ea
commit
7c19b9d3ee
2 files changed
+34
-114
No files matched your search
-3
@@ -19,9 +19,6 @@ class ListStatistikoEvents extends ListRecords
|
|||||||
Action::make('download')
|
Action::make('download')
|
||||||
->icon('phosphor-download')
|
->icon('phosphor-download')
|
||||||
->color('gray'),
|
->color('gray'),
|
||||||
Action::make('double')
|
|
||||||
->icon('phosphor-funnel')
|
|
||||||
->color('gray'),
|
|
||||||
Action::make('truncate')
|
Action::make('truncate')
|
||||||
->icon('phosphor-trash')
|
->icon('phosphor-trash')
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
|
|||||||
@@ -22,117 +22,40 @@ class ImportEvents
|
|||||||
|
|
||||||
$row = array_values($row);
|
$row = array_values($row);
|
||||||
|
|
||||||
if ($importmode == 'update') {
|
StatistikoEvent::updateOrCreate(
|
||||||
|
[
|
||||||
/*
|
'match_id' => (int) $row[0],
|
||||||
0 => 14082828
|
],
|
||||||
1 => 1
|
[
|
||||||
2 => 12
|
'sport_id' => (int) $row[1],
|
||||||
3 => 1661
|
'league_id' => (int) $row[2],
|
||||||
4 => 4781
|
'home_id' => (int) $row[3],
|
||||||
*/
|
'away_id' => (int) $row[4],
|
||||||
StatistikoEvent::updateOrCreate(
|
'starttime' => Carbon::parse($row[5])->toIso8601String(),
|
||||||
[
|
'season' => (string) $row[6],
|
||||||
'match_id' => (int) $row[0],
|
'gls_h' => (int) $row[7],
|
||||||
'sport_id' => (int) $row[1],
|
'gls_a' => (int) $row[8],
|
||||||
'league_id' => (int) $row[2],
|
'crn_h' => (int) $row[9],
|
||||||
'home_id' => (int) $row[3],
|
'crn_a' => (int) $row[10],
|
||||||
'away_id' => (int) $row[4],
|
'fls_h' => (int) $row[11],
|
||||||
'starttime' => Carbon::parse($row[5])->toIso8601String(),
|
'fls_a' => (int) $row[12],
|
||||||
],
|
'ofs_h' => (int) $row[13],
|
||||||
[
|
'ofs_a' => (int) $row[14],
|
||||||
'season' => (string) $row[6],
|
'snt_h' => (int) $row[15],
|
||||||
'gls_h' => (int) $row[7],
|
'snt_a' => (int) $row[16],
|
||||||
'gls_a' => (int) $row[8],
|
'tsh_h' => (int) $row[17],
|
||||||
'crn_h' => (int) $row[9],
|
'tsh_a' => (int) $row[18],
|
||||||
'crn_a' => (int) $row[10],
|
'crd_h' => (int) $row[19],
|
||||||
'fls_h' => (int) $row[11],
|
'crd_a' => (int) $row[20],
|
||||||
'fls_a' => (int) $row[12],
|
'exp_home' => (float) $row[21],
|
||||||
'ofs_h' => (int) $row[13],
|
'exp_away' => (float) $row[22],
|
||||||
'ofs_a' => (int) $row[14],
|
'exp_handicap' => (float) $row[23],
|
||||||
'snt_h' => (int) $row[15],
|
'exp_total' => (float) $row[24],
|
||||||
'snt_a' => (int) $row[16],
|
'result_code' => $row[25], // w, d, l
|
||||||
'tsh_h' => (int) $row[17],
|
'created_at' => $now,
|
||||||
'tsh_a' => (int) $row[18],
|
'updated_at' => $now,
|
||||||
'crd_h' => (int) $row[19],
|
]
|
||||||
'crd_a' => (int) $row[20],
|
);
|
||||||
'exp_home' => (float) $row[21],
|
|
||||||
'exp_away' => (float) $row[22],
|
|
||||||
'exp_handicap' => (float) $row[23],
|
|
||||||
'exp_total' => (float) $row[24],
|
|
||||||
'result_code' => $row[25], // w, d, l
|
|
||||||
'created_at' => $now,
|
|
||||||
'updated_at' => $now,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
// StatistikoEvent::where('match_id', (int) $row[0])
|
|
||||||
// ->where('sport_id', (int) $row[1])
|
|
||||||
// ->where('league_id', (int) $row[2])
|
|
||||||
// ->where('home_id', (int) $row[3])
|
|
||||||
// ->where('away_id', (int) $row[4])
|
|
||||||
// ->where('starttime', Carbon::parse($row[5])->toIso8601String())
|
|
||||||
// ->update(
|
|
||||||
// [
|
|
||||||
// 'season' => (int) $row[6],
|
|
||||||
// 'gls_h' => (int) $row[7],
|
|
||||||
// 'gls_a' => (int) $row[8],
|
|
||||||
// 'crn_h' => (int) $row[9],
|
|
||||||
// 'crn_a' => (int) $row[10],
|
|
||||||
// 'fls_h' => (int) $row[11],
|
|
||||||
// 'fls_a' => (int) $row[12],
|
|
||||||
// 'ofs_h' => (int) $row[13],
|
|
||||||
// 'ofs_a' => (int) $row[14],
|
|
||||||
// 'snt_h' => (int) $row[15],
|
|
||||||
// 'snt_a' => (int) $row[16],
|
|
||||||
// 'tsh_h' => (int) $row[17],
|
|
||||||
// 'tsh_a' => (int) $row[18],
|
|
||||||
// 'crd_h' => (int) $row[19],
|
|
||||||
// 'crd_a' => (int) $row[20],
|
|
||||||
// 'exp_home' => (float) $row[21],
|
|
||||||
// 'exp_away' => (float) $row[22],
|
|
||||||
// 'exp_handicap' => (float) $row[23],
|
|
||||||
// 'exp_total' => (float) $row[24],
|
|
||||||
// 'result_code' => $row[25], // w, d, l
|
|
||||||
// 'created_at' => $now,
|
|
||||||
// 'updated_at' => $now,
|
|
||||||
// ],
|
|
||||||
// ['upsert' => true],
|
|
||||||
// );
|
|
||||||
} else {
|
|
||||||
StatistikoEvent::insert(
|
|
||||||
[
|
|
||||||
'match_id' => (int) $row[0],
|
|
||||||
'sport_id' => (int) $row[1],
|
|
||||||
'league_id' => (int) $row[2],
|
|
||||||
'home_id' => (int) $row[3],
|
|
||||||
'away_id' => (int) $row[4],
|
|
||||||
'starttime' => Carbon::parse($row[5])->toIso8601String(),
|
|
||||||
'season' => (string) $row[6],
|
|
||||||
'gls_h' => (int) $row[7],
|
|
||||||
'gls_a' => (int) $row[8],
|
|
||||||
'crn_h' => (int) $row[9],
|
|
||||||
'crn_a' => (int) $row[10],
|
|
||||||
'fls_h' => (int) $row[11],
|
|
||||||
'fls_a' => (int) $row[12],
|
|
||||||
'ofs_h' => (int) $row[13],
|
|
||||||
'ofs_a' => (int) $row[14],
|
|
||||||
'snt_h' => (int) $row[15],
|
|
||||||
'snt_a' => (int) $row[16],
|
|
||||||
'tsh_h' => (int) $row[17],
|
|
||||||
'tsh_a' => (int) $row[18],
|
|
||||||
'crd_h' => (int) $row[19],
|
|
||||||
'crd_a' => (int) $row[20],
|
|
||||||
'exp_home' => (float) $row[21],
|
|
||||||
'exp_away' => (float) $row[22],
|
|
||||||
'exp_handicap' => (float) $row[23],
|
|
||||||
'exp_total' => (float) $row[24],
|
|
||||||
'result_code' => $row[25], // w, d, l
|
|
||||||
'created_at' => $now,
|
|
||||||
'updated_at' => $now,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user