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 <?php
namespace App\Console\Commands\Grapper; namespace App\Console\Commands;
use App\Console\Commands\Grapper\TxOdds\TxOdds; use App\Console\Commands\Grapper\TxOdds\TxOdds;
use App\Models\Supervisor; use App\Models\Supervisor;
@@ -8,7 +8,7 @@ use App\Utilities\Notice;
use App\Utilities\Supervisorctl; use App\Utilities\Supervisorctl;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class Grapper extends Command class NuhBash extends Command
{ {
public static $event = []; public static $event = [];
@@ -26,32 +26,37 @@ class Grapper extends Command
public static $auth = ''; 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() public function handle()
{ {
self::$options = $this->options(); self::$options = $this->options();
dd(self::$options);
self::$options['supervisor_id'] = $this->argument('process'); self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid'); self::$options['event_id'] = $this->argument('eventid');
if ($this->argument('process') == 'help') { 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 .= '--d debug'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL; $txt .= '--f force update market'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL; $txt .= '--a reload all'.PHP_EOL;
$txt .= '--w reload one week'.PHP_EOL; $txt .= '--w reload one week'.PHP_EOL;
$txt .= '--p print odds'.PHP_EOL.PHP_EOL; $txt .= '--p print odds'.PHP_EOL;
$txt .= 'eventid'.PHP_EOL.PHP_EOL; $txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'use "gra l" to show options'.PHP_EOL; $txt .= 'List of supervisors'.PHP_EOL;
Notice::note($txt, 'b', 1); $txt .= '----------------------------------------------'.PHP_EOL;
} elseif ($this->argument('process') == 'l') { $tmp = Supervisor::all();
$txt = 'list of grapper processes'; foreach ($tmp as $value) {
$txt .= Supervisor::list('gra'); $txt .= $value->provider->name.' '.$value->id.' - '.$value->type.' '.$value->name.PHP_EOL;
}
Notice::note($txt, 'b', 1); Notice::note($txt, 'b', 1);
} }
@@ -6,6 +6,9 @@ use App\Models\Bookmaker;
use App\Models\Sport; use App\Models\Sport;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; 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; use Filament\Schemas\Schema;
class SupervisorForm class SupervisorForm
@@ -16,7 +19,14 @@ class SupervisorForm
->components([ ->components([
TextInput::make('name') TextInput::make('name')
->required() ->required()
->default(null), ->columnSpan(2),
Select::make('type')
->options([
'Grapper' => 'Grapper',
'Comparatore' => 'Comparatore',
])
->default('grapper')
->selectablePlaceholder(false),
Select::make('provider_id') Select::make('provider_id')
->relationship('provider', 'name') ->relationship('provider', 'name')
->required() ->required()
@@ -26,15 +36,16 @@ class SupervisorForm
->nullable(), ->nullable(),
Select::make('bookmaker_id') Select::make('bookmaker_id')
->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id')) ->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id'))
->nullable(), ->selectablePlaceholder(true),
TextInput::make('sleep') Fieldset::make('Supervisor or Cron Toggle')
->required() ->schema([
->numeric() Toggle::make('is_cron')->live(),
->default(30), TextInput::make('sleep')
TextInput::make('limit') ->label('Sleep between loops')
->required() ->hidden(fn (Get $get): bool => $get('is_cron'))
->numeric() ->numeric()
->default(0), ->default(30),
])->columnSpan(2),
]); ]);
} }
} }
@@ -2,9 +2,11 @@
namespace App\Filament\Resources\Supervisors\Tables; namespace App\Filament\Resources\Supervisors\Tables;
use App\Models\Bookmaker;
use Filament\Actions\BulkActionGroup; use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction; use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction; use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn; use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -18,6 +20,7 @@ class SupervisorsTable
TextColumn::make('id')->badge(), TextColumn::make('id')->badge(),
TextColumn::make('name') TextColumn::make('name')
->searchable(), ->searchable(),
TextColumn::make('type')->badge(),
TextColumn::make('provider.name') TextColumn::make('provider.name')
->badge()->color(fn (string $state): string => match ($state) { ->badge()->color(fn (string $state): string => match ($state) {
'txodds' => 'danger', 'txodds' => 'danger',
@@ -25,15 +28,19 @@ class SupervisorsTable
'direct' => 'primary', 'direct' => 'primary',
default => 'warning', default => 'warning',
}), }),
TextColumn::make('sport_id')->label('Sport'), TextColumn::make('sport.name')->label('Sport'),
TextColumn::make('bookmaker_id')->label('Book'), 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('sleep')->numeric(),
TextColumn::make('limit')->numeric(), TextColumn::make('runtime'),
TextColumn::make('runtime')->label('Duration'),
TextColumn::make('events')->numeric(),
TextColumn::make('lastcall'), TextColumn::make('lastcall'),
ToggleColumn::make('is_cron')->label('Cron'), IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
ToggleColumn::make('is_active')->label('Status'), ToggleColumn::make('is_active')->label('On/Off'),
TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
+1
View File
@@ -8,6 +8,7 @@ class Supervisor extends Model
{ {
protected $fillable = [ protected $fillable = [
'name', 'name',
'type',
'provider_id', 'provider_id',
'sport_id', 'sport_id',
'bookmaker_id', 'bookmaker_id',
Generated
+34 -34
View File
@@ -1845,22 +1845,22 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "7.9.3", "version": "7.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"guzzlehttp/promises": "^1.5.3 || ^2.0.3", "guzzlehttp/promises": "^2.3",
"guzzlehttp/psr7": "^2.7.0", "guzzlehttp/psr7": "^2.8",
"php": "^7.2.5 || ^8.0", "php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0", "psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0" "symfony/deprecation-contracts": "^2.2 || ^3.0"
@@ -1951,7 +1951,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/guzzle/issues", "issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.9.3" "source": "https://github.com/guzzle/guzzle/tree/7.10.0"
}, },
"funding": [ "funding": [
{ {
@@ -1967,20 +1967,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-03-27T13:37:11+00:00" "time": "2025-08-23T22:36:01+00:00"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
"version": "2.2.0", "version": "2.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/promises.git", "url": "https://github.com/guzzle/promises.git",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" "reference": "481557b130ef3790cf82b713667b43030dc9c957"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "reference": "481557b130ef3790cf82b713667b43030dc9c957",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1988,7 +1988,7 @@
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.39 || ^9.6.20" "phpunit/phpunit": "^8.5.44 || ^9.6.25"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -2034,7 +2034,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/promises/issues", "issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.2.0" "source": "https://github.com/guzzle/promises/tree/2.3.0"
}, },
"funding": [ "funding": [
{ {
@@ -2050,20 +2050,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-03-27T13:27:01+00:00" "time": "2025-08-22T14:34:08+00:00"
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "2.7.1", "version": "2.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" "reference": "21dc724a0583619cd1652f673303492272778051"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "reference": "21dc724a0583619cd1652f673303492272778051",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2079,7 +2079,7 @@
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "0.9.0", "http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.39 || ^9.6.20" "phpunit/phpunit": "^8.5.44 || ^9.6.25"
}, },
"suggest": { "suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
@@ -2150,7 +2150,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.7.1" "source": "https://github.com/guzzle/psr7/tree/2.8.0"
}, },
"funding": [ "funding": [
{ {
@@ -2166,20 +2166,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-03-27T12:30:47+00:00" "time": "2025-08-23T21:21:41+00:00"
}, },
{ {
"name": "guzzlehttp/uri-template", "name": "guzzlehttp/uri-template",
"version": "v1.0.4", "version": "v1.0.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/uri-template.git", "url": "https://github.com/guzzle/uri-template.git",
"reference": "30e286560c137526eccd4ce21b2de477ab0676d2" "reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/30e286560c137526eccd4ce21b2de477ab0676d2", "url": "https://api.github.com/repos/guzzle/uri-template/zipball/4f4bbd4e7172148801e76e3decc1e559bdee34e1",
"reference": "30e286560c137526eccd4ce21b2de477ab0676d2", "reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2188,7 +2188,7 @@
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.36 || ^9.6.15", "phpunit/phpunit": "^8.5.44 || ^9.6.25",
"uri-template/tests": "1.0.0" "uri-template/tests": "1.0.0"
}, },
"type": "library", "type": "library",
@@ -2236,7 +2236,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/uri-template/issues", "issues": "https://github.com/guzzle/uri-template/issues",
"source": "https://github.com/guzzle/uri-template/tree/v1.0.4" "source": "https://github.com/guzzle/uri-template/tree/v1.0.5"
}, },
"funding": [ "funding": [
{ {
@@ -2252,7 +2252,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-02-03T10:55:03+00:00" "time": "2025-08-22T14:27:06+00:00"
}, },
{ {
"name": "jaybizzle/crawler-detect", "name": "jaybizzle/crawler-detect",
@@ -2391,16 +2391,16 @@
}, },
{ {
"name": "joaopaulolndev/filament-edit-profile", "name": "joaopaulolndev/filament-edit-profile",
"version": "v2.0.8", "version": "v2.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/joaopaulolndev/filament-edit-profile.git", "url": "https://github.com/joaopaulolndev/filament-edit-profile.git",
"reference": "f50ed328b43839e80e0e4071aac09439e46bd77c" "reference": "1ebf29f947c9f15dd6cb0c992ea77e23115403aa"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/joaopaulolndev/filament-edit-profile/zipball/f50ed328b43839e80e0e4071aac09439e46bd77c", "url": "https://api.github.com/repos/joaopaulolndev/filament-edit-profile/zipball/1ebf29f947c9f15dd6cb0c992ea77e23115403aa",
"reference": "f50ed328b43839e80e0e4071aac09439e46bd77c", "reference": "1ebf29f947c9f15dd6cb0c992ea77e23115403aa",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2460,7 +2460,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-08-19T23:50:20+00:00" "time": "2025-08-24T01:29:06+00:00"
}, },
{ {
"name": "kirschbaum-development/eloquent-power-joins", "name": "kirschbaum-development/eloquent-power-joins",
@@ -14,10 +14,11 @@ return new class extends Migration
Schema::create('supervisors', function (Blueprint $table) { Schema::create('supervisors', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('type');
$table->integer('provider_id')->default(0); $table->integer('provider_id')->default(0);
$table->integer('sport_id')->default(0); $table->integer('sport_id')->default(0)->nullable();
$table->integer('bookmaker_id')->default(0); $table->integer('bookmaker_id')->default(0)->nullable();
$table->integer('sleep')->default(10); $table->integer('sleep')->default(10);
$table->integer('limit')->default(0); $table->integer('limit')->default(0);
@@ -1,6 +1,8 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {
+1 -1
View File
@@ -11,7 +11,7 @@ class OtherSeeder extends Seeder
{ {
$sql = "INSERT INTO `providers` (`id`, `name`) $sql = "INSERT INTO `providers` (`id`, `name`)
VALUES VALUES
('1', 'TXOdds'), ('1', 'TxOdds'),
('2', 'BetsApi'), ('2', 'BetsApi'),
('3', 'Direct'); ('3', 'Direct');
"; ";