events wip

This commit is contained in:
salam committed 2025-08-28 10:43:50 +02:00
1 parent 8d623755ca
commit a7e09c6590
25 files changed
+1112 -384

No files matched your search

@@ -1,33 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Grapper\Grapper;
use App\Models\Country;
use App\Utilities\Notice;
class Countries
{
public static function grap()
{
Notice::note('disabled as txodds data is a mess, had to fix all manually', 'r', 1);
$response = simplexml_load_file(Grapper::$domain.'feed/countries.php', null, LIBXML_NOCDATA);
foreach ($response->country as $country) {
$res = Country::where('txid', $country->id)->first();
if ($res !== null) {
// $res->txid = $country->id;
// $res->txid = $country->id;
// $res->save();
} else {
$res = new Country;
$res->name = $country->name;
$res->iso3 = $country->cc;
$res->txid = $country->id;
$res->tx_only = 1;
$res->save();
}
}
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Fixtures;
use App\Models\Country;
class TxCountries
{
public static function get($group)
{
// "group": {
// "@attributes": {
// "id": "177425",
// "cgid": "336",
// "spid": "1",
// "cnid": "381",
// "mgid": "1373",
// "cname": "UEFA Women's Champions League"
// },
// "@text": "WFBECUP UEFA Women's Champions League > Qualifying Rounds-25"
// },
$cnid = array_column($group, 'cnid');
$cname = array_column($group, 'cname');
$country = Country::firstOrCreate(
['txid' => $cnid[0]],
['name' => $cname[0]]
);
return $cnid[0];
}
}
@@ -3,7 +3,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Fixtures;
use App\Console\Commands\NuhBash;
use App\Models\Country;
use App\Models\Liga;
class TxLigas
@@ -12,12 +11,10 @@ class TxLigas
{
$debug = NuhBash::$options['debug'] ?? 0;
$cgid = array_column($group, 'cgid');
$cnid = array_column($group, 'cnid');
$spid = array_column($group, 'spid');
$cname = array_column($group, 'cname');
$country_id = Country::where('txid', $cnid)->value('id');
$spid = array_column($group, 'spid');
$country_id = TxCountries::get($group);
$cgid = array_column($group, 'cgid');
$liga = Liga::firstOrCreate([
'name' => (string) $cname[0],
@@ -13,19 +13,24 @@ class FixturesSoccer
{
public static function call()
{
$debug = NuhBash::$options['debug'] ?? 0;
$debug = NuhBash::$options['d'] ?? 0;
$print = NuhBash::$options['p'] ?? 0;
$total = 0;
for ($i = 0; $i < 30; $i++) {
$str1 = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $i, date('Y')));
$str2 = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + 1 + $i, date('Y')));
$url = 'https://xml2.txodds.com/feed/result/xml.php?ident=betaid1&passwd='.config('nuh.txodds_token')."&date=$str1,$str2&json=2";
$data = Curl::load($url, $debug);
$i = 0;
if ($print) {
Notice::note($data, '', 1);
}
$count = 0;
foreach ($data['match'] as $row) {
$i++;
$count++;
$txodds_id = array_column($row, 'id');
$spid = array_column($row['group'], 'spid');
$liga_id = TxLigas::find($row['group']);
@@ -43,7 +48,9 @@ class FixturesSoccer
]);
// dd($event);
}
Notice::note("$i events processed", 'g');
Notice::note("$str1 - $count events processed", 'g');
$total += $count;
}
Notice::note("Total - $total events processed", 'g');
}
}
-14
View File
@@ -10,22 +10,8 @@ use Illuminate\Console\Command;
class NuhBash extends Command
{
public static $event = [];
public static $_send = [];
public static $sport_id = 0;
public static $options = [];
public static $force = 0;
public static $debug = 0;
public static $domain = '';
public static $auth = '';
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w} {--s} {--l}';
protected $description = 'NuhBash';