wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utilities;
|
||||
|
||||
use App\Actions\SupervisorMaker;
|
||||
use App\Models\Supervisor;
|
||||
|
||||
class Supervisorctl
|
||||
{
|
||||
public static $starttime = 0;
|
||||
|
||||
public static $code = '';
|
||||
|
||||
public static function start(&$options)
|
||||
{
|
||||
$debug = $options['d'] ?? 0;
|
||||
$proxy = $options['p'] ?? 0;
|
||||
$maker = $options['x'] ?? 0;
|
||||
$runanyway = $options['f'] ?? 0;
|
||||
|
||||
// sleep for 0,5 seconds
|
||||
usleep(500000);
|
||||
|
||||
self::$starttime = microtime(true);
|
||||
|
||||
self::$code = $options['supervisor_id'];
|
||||
|
||||
$supervisor = Supervisor::with('sport')->with('provider')->find(self::$code)->toArray();
|
||||
|
||||
$options['name'] = $supervisor['name'];
|
||||
$options['sport_id'] = $supervisor['sport_id'];
|
||||
$options['txodds_market_id'] = $supervisor['txodds_market_id'];
|
||||
$options['sleep'] = $supervisor['sleep'];
|
||||
$options['lastcall'] = $supervisor['lastcall'];
|
||||
$options['commandline_options'] = $supervisor['commandline_options'];
|
||||
$options['is_active'] = $supervisor['is_active'];
|
||||
$options['days_from'] = $supervisor['days_from'];
|
||||
$options['days_to'] = $supervisor['days_to'];
|
||||
$options['is_supervisor'] = $supervisor['is_supervisor'];
|
||||
|
||||
if (isset($supervisor['sport']['name'])) {
|
||||
$options['sport'] = $supervisor['sport']['name'];
|
||||
}
|
||||
|
||||
if ($supervisor['provider']) {
|
||||
$options['provider_id'] = $supervisor['provider']['id'];
|
||||
$options['provider'] = $supervisor['provider']['name'];
|
||||
$options['base_url'] = $supervisor['provider']['base_url'];
|
||||
}
|
||||
|
||||
if ($maker) {
|
||||
SupervisorMaker::run($supervisor);
|
||||
}
|
||||
|
||||
if ($supervisor) {
|
||||
if ($debug) {
|
||||
Notice::note('supervisor start '.self::$code, 'g');
|
||||
}
|
||||
|
||||
if ($proxy) {
|
||||
$options['proxy'] = 'https://prox2.nuhodds.com/proxy.php';
|
||||
}
|
||||
|
||||
if ($options['sleep'] > 0) {
|
||||
if (! $debug) {
|
||||
sleep($options['sleep']);
|
||||
} else {
|
||||
if ($options['is_supervisor']) {
|
||||
Notice::note('cron process', 'b');
|
||||
} else {
|
||||
Notice::note('production sleeps '.$options['sleep'].'sec', 'b');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($options['provider_id']) {
|
||||
case 3:
|
||||
// MAGLOO KENIA
|
||||
$options['bookmaker_id'] = 16;
|
||||
break;
|
||||
case 4:
|
||||
// MAGLOO NIGERIA
|
||||
$options['bookmaker_id'] = 10;
|
||||
break;
|
||||
case 5:
|
||||
// LOGIFUTURE NIGERA
|
||||
$options['bookmaker_id'] = 35;
|
||||
break;
|
||||
case 6:
|
||||
// LOGIFUTURE COLOMBIA
|
||||
$options['bookmaker_id'] = 36;
|
||||
break;
|
||||
case 9:
|
||||
// BETICA
|
||||
$options['bookmaker_id'] = 14;
|
||||
break;
|
||||
case 10:
|
||||
// GOLDBET
|
||||
$options['bookmaker_id'] = 128;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (! $options['is_active'] && ! $runanyway) {
|
||||
Notice::note('Process disabled, sleeps 2 min then exit', 'r');
|
||||
sleep(120);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
Notice::note('unknown supervisor: '.self::$code, 'r', 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function end($options)
|
||||
{
|
||||
$processend = microtime(true);
|
||||
$runtime = round(($processend - self::$starttime) / 60, 3);
|
||||
Supervisor::where('id', self::$code)->update(['runtime' => $runtime]);
|
||||
if ($options['d']) {
|
||||
Notice::note('spervisor time: '.$runtime.' min', 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user