115 lines
3.4 KiB
PHP
115 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Console\Commands\Grapper\Magloo;
|
|
use App\Console\Commands\Grapper\TxOdds;
|
|
use App\Models\Supervisor;
|
|
use App\Utilities\Notice;
|
|
use App\Utilities\Supervisorctl;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class Nuh extends Command
|
|
{
|
|
public static $options = [];
|
|
|
|
public static $_event;
|
|
|
|
public static $_event_bookmaker;
|
|
|
|
public static $bookmaker_id;
|
|
|
|
public static $AUTHTOKEN;
|
|
|
|
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
|
|
|
|
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--w} {--p} {--e} {--s} {--r} {--b} {--q} {--t}';
|
|
|
|
protected $description = 'Nuh';
|
|
|
|
public function handle()
|
|
{
|
|
self::$options = $this->options();
|
|
self::$options['supervisor_id'] = $this->argument('process');
|
|
self::$options['event_id'] = $this->argument('eventid');
|
|
|
|
$queries = self::$options['q'] ?? 0;
|
|
|
|
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 .= '--a reload all'.PHP_EOL;
|
|
$txt .= '--b break loop after one '.PHP_EOL;
|
|
|
|
$txt .= '--d debug'.PHP_EOL;
|
|
$txt .= '--e echo file'.PHP_EOL;
|
|
$txt .= '--f force update market'.PHP_EOL;
|
|
|
|
$txt .= '--p use proydb1'.PHP_EOL;
|
|
$txt .= '--q print queries'.PHP_EOL;
|
|
$txt .= '--r read data from file '.PHP_EOL;
|
|
|
|
$txt .= '--s store data to file '.PHP_EOL;
|
|
$txt .= '--t test server url '.PHP_EOL;
|
|
$txt .= '--w reload one week'.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);
|
|
}
|
|
|
|
if ($queries) {
|
|
DB::enableQueryLog();
|
|
}
|
|
|
|
Supervisorctl::start(self::$options);
|
|
|
|
if (! self::$options['is_active']) {
|
|
Notice::note('Process disabled', 'r', 1);
|
|
}
|
|
|
|
switch (self::$options['provider_id']) {
|
|
case 1:
|
|
TxOdds::switch();
|
|
case 2:
|
|
// betsapi
|
|
break;
|
|
case 3:
|
|
// MAGLOO KENIA
|
|
break;
|
|
case 4:
|
|
// MAGLOO NIGERIA
|
|
Magloo::switch();
|
|
break;
|
|
case 5:
|
|
// LOGIFUTUR NIGERA
|
|
break;
|
|
case 6:
|
|
// LOGIFUTUR COLOMBIA
|
|
break;
|
|
default:
|
|
Notice::note('Provider not defined', 'r', 1);
|
|
break;
|
|
}
|
|
|
|
Supervisorctl::end(self::$options);
|
|
|
|
if ($queries) {
|
|
Notice::db(DB::getQueryLog());
|
|
}
|
|
|
|
}
|
|
}
|