grapper wip

This commit is contained in:
salam committed 2025-08-25 12:57:17 +02:00
1 parent 944aa736b2
commit adb15e701b
9 files changed
+95 -68

No files matched your search

@@ -1,6 +1,6 @@
<?php
namespace App\Console\Commands\Grapper;
namespace App\Console\Commands;
use App\Console\Commands\Grapper\TxOdds\TxOdds;
use App\Models\Supervisor;
@@ -8,7 +8,7 @@ use App\Utilities\Notice;
use App\Utilities\Supervisorctl;
use Illuminate\Console\Command;
class Grapper extends Command
class NuhBash extends Command
{
public static $event = [];
@@ -26,32 +26,37 @@ class Grapper extends Command
public static $auth = '';
protected $signature = 'gra {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w}';
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w}';
protected $description = 'Grapper';
protected $description = 'NuhBash';
public function handle()
{
self::$options = $this->options();
dd(self::$options);
self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid');
if ($this->argument('process') == 'help') {
$txt = PHP_EOL.'a gra process [id] eventid [id]'.PHP_EOL;
$txt = 'List of parameters'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'process [id] (required)'.PHP_EOL;
$txt .= 'eventid [id] (optional)'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'List of options'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--w reload one week'.PHP_EOL;
$txt .= '--p print odds'.PHP_EOL.PHP_EOL;
$txt .= 'eventid'.PHP_EOL.PHP_EOL;
$txt .= 'use "gra l" to show options'.PHP_EOL;
Notice::note($txt, 'b', 1);
} elseif ($this->argument('process') == 'l') {
$txt = 'list of grapper processes';
$txt .= Supervisor::list('gra');
$txt .= '--p print odds'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'List of supervisors'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$tmp = Supervisor::all();
foreach ($tmp as $value) {
$txt .= $value->provider->name.' '.$value->id.' - '.$value->type.' '.$value->name.PHP_EOL;
}
Notice::note($txt, 'b', 1);
}
@@ -6,6 +6,9 @@ use App\Models\Bookmaker;
use App\Models\Sport;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class SupervisorForm
@@ -16,7 +19,14 @@ class SupervisorForm
->components([
TextInput::make('name')
->required()
->default(null),
->columnSpan(2),
Select::make('type')
->options([
'Grapper' => 'Grapper',
'Comparatore' => 'Comparatore',
])
->default('grapper')
->selectablePlaceholder(false),
Select::make('provider_id')
->relationship('provider', 'name')
->required()
@@ -26,15 +36,16 @@ class SupervisorForm
->nullable(),
Select::make('bookmaker_id')
->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id'))
->nullable(),
TextInput::make('sleep')
->required()
->numeric()
->default(30),
TextInput::make('limit')
->required()
->numeric()
->default(0),
->selectablePlaceholder(true),
Fieldset::make('Supervisor or Cron Toggle')
->schema([
Toggle::make('is_cron')->live(),
TextInput::make('sleep')
->label('Sleep between loops')
->hidden(fn (Get $get): bool => $get('is_cron'))
->numeric()
->default(30),
])->columnSpan(2),
]);
}
}
@@ -2,9 +2,11 @@
namespace App\Filament\Resources\Supervisors\Tables;
use App\Models\Bookmaker;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
@@ -18,6 +20,7 @@ class SupervisorsTable
TextColumn::make('id')->badge(),
TextColumn::make('name')
->searchable(),
TextColumn::make('type')->badge(),
TextColumn::make('provider.name')
->badge()->color(fn (string $state): string => match ($state) {
'txodds' => 'danger',
@@ -25,15 +28,19 @@ class SupervisorsTable
'direct' => 'primary',
default => 'warning',
}),
TextColumn::make('sport_id')->label('Sport'),
TextColumn::make('bookmaker_id')->label('Book'),
TextColumn::make('sport.name')->label('Sport'),
IconColumn::make('bookmaker_id')
->label('Book')
->icon(function ($state): string {
if ($state) {
return 'bkm-'.Bookmaker::where('id', $state)->pluck('icon')->first();
}
}),
TextColumn::make('sleep')->numeric(),
TextColumn::make('limit')->numeric(),
TextColumn::make('runtime')->label('Duration'),
TextColumn::make('events')->numeric(),
TextColumn::make('runtime'),
TextColumn::make('lastcall'),
ToggleColumn::make('is_cron')->label('Cron'),
ToggleColumn::make('is_active')->label('Status'),
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
ToggleColumn::make('is_active')->label('On/Off'),
TextColumn::make('created_at')
->dateTime()
->sortable()
+1
View File
@@ -8,6 +8,7 @@ class Supervisor extends Model
{
protected $fillable = [
'name',
'type',
'provider_id',
'sport_id',
'bookmaker_id',