groups and major groups ok

This commit is contained in:
salam committed 2026-02-27 06:44:56 +01:00
1 parent 859038cc8c
commit 165fbd370f
8 files changed
+203 -184

No files matched your search

+24 -8
View File
@@ -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');
@@ -235,7 +235,7 @@ class EventsTable
$arr = [];
foreach ($res as $val) {
$arr[$val->competition_group_id] = $val->country?->name.' '.$val->competition_group->name;
$arr[$val->competition_group_id] = $val->country?->name.' '.$val->competition_group?->name;
}
asort($arr);