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';
@@ -3,8 +3,6 @@
namespace App\Filament\Clusters\Maintenance\Resources\Events;
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\CreateEvent;
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\EditEvent;
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\ListEvents;
use App\Filament\Clusters\Maintenance\Resources\Events\Schemas\EventForm;
use App\Filament\Clusters\Maintenance\Resources\Events\Tables\EventsTable;
@@ -48,8 +46,6 @@ class EventResource extends Resource
{
return [
'index' => ListEvents::route('/'),
'create' => CreateEvent::route('/create'),
'edit' => EditEvent::route('/{record}/edit'),
];
}
}
@@ -10,54 +10,67 @@ class EventForm
{
public static function configure(Schema $schema): Schema
{
// `starttime` datetime DEFAULT NULL,
// `sport_id` int(11) NOT NULL,
// `provider_id` int(11) DEFAULT 0,
// `txodds_id` int(11) DEFAULT 0,
// `betaid_id` int(11) DEFAULT 0,
// `betradar_id` int(11) DEFAULT 0,
// `magnig_id` int(11) DEFAULT 0,
// `magken_id` int(11) DEFAULT 0,
// `lognig_id` int(11) DEFAULT 0,
// `logcol_id` int(11) DEFAULT 0,
// `liga_id` int(11) DEFAULT 0,
// `home_id` int(11) DEFAULT 0,
// `away_id` int(11) DEFAULT 0,
return $schema
->components([
DateTimePicker::make('time'),
TextInput::make('spid')
DateTimePicker::make('starttime')
->aboveContent(['UTC time +1h']),
TextInput::make('sport_id')
->required()
->numeric(),
TextInput::make('prid')
->numeric()
->aboveContent(fn ($record): string => $record->sport->name),
TextInput::make('liga_id')
->numeric()
->default(0)
->aboveContent(fn ($record): string => $record->liga->name),
TextInput::make('home_id')
->required()
->aboveContent(fn ($record): string => $record->home->name),
TextInput::make('away_id')
->required()
->aboveContent(fn ($record): string => $record->away->name),
TextInput::make('provider_id')
->aboveContent(['1 TXOdds', '2 BetsApi', '3 Direct'])
->required()
->numeric()
->default(0),
TextInput::make('txid')
->required()
TextInput::make('txodds_id')
->numeric()
->default(0),
TextInput::make('brid')
->required()
TextInput::make('betaid_id')
->numeric()
->default(0),
TextInput::make('baid')
->required()
TextInput::make('betradar_id')
->numeric()
->default(0),
TextInput::make('cnid')
->required()
TextInput::make('magnig_id')
->label('Magloo Nigeria Id')
->numeric()
->default(0),
TextInput::make('grid')
->required()
TextInput::make('magken_id')
->label('Magloo Kenia Id')
->numeric()
->default(0),
TextInput::make('cgid')
->required()
TextInput::make('lognig_id')
->label('Logifuture Nigeria Id')
->numeric()
->default(0),
TextInput::make('hoid')
->required()
TextInput::make('logcol_id')
->label('Logifuture Colombia Id')
->numeric()
->default(0),
TextInput::make('awid')
->required()
->numeric()
->default(0),
TextInput::make('liga')
->required(),
TextInput::make('home')
->required(),
TextInput::make('away')
->required(),
]);
}
}
@@ -21,11 +21,11 @@ class EventsTable
return $record->sport->icon;
}),
TextColumn::make('starttime')->dateTime('M j, Y H:i')->sortable(),
IconColumn::make('liga')
->label('')
->icon(function ($record): string {
return 'flag-country-'.$record->liga->country->iso2;
IconColumn::make('liga.country.icon')->label('')
->icon(function ($state): string {
return $state;
}),
TextColumn::make('liga.country.name'),
TextColumn::make('liga.name')->searchable(),
TextColumn::make('home.name')->searchable(),
TextColumn::make('away.name')->searchable(),
@@ -34,12 +34,13 @@ class CountryResource extends Resource
{
return $schema
->components([
TextInput::make('name')
->required()
->maxLength(255),
TextInput::make('iso2')
->required()
->maxLength(2),
TextInput::make('name')->required()->maxLength(255)->copyable(),
TextInput::make('icon')->maxLength(255),
TextInput::make('iso2')->maxLength(2),
TextInput::make('iso3')->maxLength(2),
TextInput::make('cc')->maxLength(2),
TextInput::make('numeric')->maxLength(2),
TextInput::make('txid')->maxLength(4),
]);
}
@@ -47,12 +48,17 @@ class CountryResource extends Resource
{
return $table
->recordTitleAttribute('name')
->description('Flags made from iso2 column')
->columns([
IconColumn::make('iso2')->icon(function ($record): string {
return 'flag-country-'.$record->iso2;
})->label('Flags')->size(IconSize::TwoExtraLarge),
TextColumn::make('name')->searchable(),
IconColumn::make('icon')
->sortable()
->icon(function ($state): string {
return $state;
})->label('Flags')->size(IconSize::TwoExtraLarge),
TextColumn::make('name')
->searchable()
->copyable()
->copyMessage('Name copied')
->copyMessageDuration(1500),
// TextColumn::make('iso2'),
TextColumn::make('iso3'),
TextColumn::make('cc'),
@@ -60,6 +66,7 @@ class CountryResource extends Resource
TextColumn::make('txid'),
])
->defaultSort('name', direction: 'asc')
->filters([
//
])
+13 -1
View File
@@ -4,4 +4,16 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Country extends Model {}
class Country extends Model
{
protected $fillable = [
'name',
'icon',
'iso2',
'iso3',
'cc',
'numeric',
'txid',
'tx_only',
];
}