groups and major groups ok
This commit is contained in:
1 parent
859038cc8c
commit
165fbd370f
8 files changed
+203
-184
No files matched your search
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\Group;
|
||||
use App\Models\MajorGroup;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
@@ -16,9 +17,9 @@ class Groups
|
||||
|
||||
$kontos = ['soccer' => config('env.txodds_betaid1'), 'other' => config('env.txodds_betaid2')];
|
||||
|
||||
$sports = Sport::getActiveSports();
|
||||
$sport_map = Sport::getActiveSports();
|
||||
|
||||
Group::whereNotIn('sport_id', $sports)->delete();
|
||||
Group::whereNotIn('sport_id', $sport_map)->delete();
|
||||
|
||||
$years = [date('y'), date('y') + 1];
|
||||
|
||||
@@ -26,26 +27,41 @@ class Groups
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/groups.php?'.$authentication.'&sid='.implode(',', $years);
|
||||
|
||||
$data = Xml::load($url);
|
||||
// <group>
|
||||
// <id>181996</id>
|
||||
// <mgroup id="1002">FBARG</mgroup>
|
||||
// <name>Supercopa Entre Rios</name>
|
||||
// <sid>26</sid>
|
||||
// <fullname>FBARG Supercopa Entre Rios-26</fullname>
|
||||
// <date1>2025-12-13 00:00:00</date1>
|
||||
// <date2>2026-04-30 00:00:00</date2>
|
||||
// </group>
|
||||
|
||||
dd($data);
|
||||
$data = Xml::load($url);
|
||||
|
||||
$count = 0;
|
||||
foreach ($data as $row) {
|
||||
if (in_array()) {
|
||||
|
||||
$mgroup = $row->mgroup;
|
||||
|
||||
$sport_id = MajorGroup::where('name', $mgroup)->value('sport_id');
|
||||
|
||||
if (in_array($sport_id, $sport_map)) {
|
||||
|
||||
Group::updateOrCreate(
|
||||
['id' => (int) $row->id],
|
||||
[
|
||||
'mgroup' => (string) $row->mgroup,
|
||||
'name' => (string) $row->name,
|
||||
'fullname' => (string) $row->fullname,
|
||||
'sid' => (string) $row->sid,
|
||||
'mgroup' => (string) $row->mgroup,
|
||||
'sid' => (int) $row->sid,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'date1' => (string) $row->date1,
|
||||
'date2' => (string) $row->date2,
|
||||
]
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
Notice::note("$count groups $konto processed", 'g');
|
||||
|
||||
Reference in new issue
Block a user