Files
nuhodds_fi4/app/Console/Commands/NuhBash.php
T
2025-08-28 10:43:50 +02:00

79 lines
2.7 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Console\Commands\Grapper\TxSwitch;
use App\Models\Supervisor;
use App\Utilities\Notice;
use App\Utilities\Supervisorctl;
use Illuminate\Console\Command;
class NuhBash extends Command
{
public static $options = [];
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w} {--s} {--l}';
protected $description = 'NuhBash';
public function handle()
{
self::$options = $this->options();
self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid');
if ($this->argument('process') == 'help') {
$txt = 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.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;
$txt .= '--s store grapped file '.PHP_EOL;
$txt .= '--l load latest grapped file '.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.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);
}
Supervisorctl::start(self::$options);
switch (self::$options['type']) {
case 'Grapper':
switch (self::$options['provider_id']) {
case 1:
TxSwitch::switch();
case 2:
// betsapi
break;
case 3:
// direct
break;
default:
Note::notice('Provider not defined', 'r', 1);
break;
}
break;
case 'Comparatore':
// code...
break;
}
Supervisorctl::end(self::$options);
}
}