removed shield use superadmin

This commit is contained in:
salam committed 2025-12-01 07:42:54 +01:00
1 parent 7fd7f706bc
commit 419148cd18
60 files changed
+611 -2363

No files matched your search

@@ -1,64 +0,0 @@
<?php
namespace App\Console\Commands\Comparatore;
use App\Models\Event;
use App\Models\EventBookmaker;
use App\Models\Supervisor;
use App\Utilities\Notice;
use App\Utilities\Supervisorctl;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
class Comparatore extends Command
{
public static $events = [];
public static $sport_id = 0;
public static $options = [];
public static $force = 0;
public static $debug = 0;
protected $signature = 'com {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w}';
protected $description = 'Comparatore';
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.'a com process [id] eventid [id]'.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 feed'.PHP_EOL.PHP_EOL;
$txt .= 'eventid'.PHP_EOL.PHP_EOL;
$txt .= 'use "com l" to show options'.PHP_EOL;
Notice::note($txt, 'b', 1);
} elseif ($this->argument('process') == 'l') {
$txt = 'list of comparatore processes';
$txt .= Supervisor::list('com');
Notice::note($txt, 'b', 1);
}
Supervisorctl::start(self::$options);
$res = Event::where('time', '>', Carbon::now()->toDateTimeString())->get();
foreach ($res as $event) {
$bookmaker = EventBookmaker::where('event_id', $event->id)->get();
if ($bookmaker->count() != null) {
dd($bookmaker);
}
}
Supervisorctl::end(self::$options);
}
}
+127 -169
View File
@@ -6,6 +6,9 @@ use App\Console\Commands\Curl;
use App\Console\Commands\Grapper\Helper;
use App\Console\Commands\NuhBash;
use App\Models\Event;
use App\Models\Odds3way;
use App\Models\OddsQualify;
use App\Models\OddsTotal;
use App\Utilities\Notice;
use Carbon\Carbon;
@@ -135,8 +138,8 @@ class Odds
break;
case 'group':
$e['group'] = $v['@attributes']['cname'];
$e['gid'] = $v['@attributes']['id'];
$e['liga'] = $v['@attributes']['cname'];
$e['liid'] = $v['@attributes']['id'];
$e['cgid'] = $v['@attributes']['cgid'];
$e['spid'] = $v['@attributes']['spid'];
$e['mgid'] = $v['@attributes']['mgid'];
@@ -173,66 +176,139 @@ class Odds
switch ($type) {
case '@attributes':
$bettypeid = (int) $od['ot'];
dd('add to event bookmaker missing');
// 'book_startime' => $od['@attributes']['starting_time'],
$bmoid = $od['bmoid'];
break;
case 'odds':
switch ($bettypeid) {
case '0':
// three way
$e['odds_3ways'][] = [
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'matchpart_id' => 1,
'sport_id' => 1,
'bmoid' => $bmoid,
'start' => $od['@attributes']['starting_time'],
'h3w' => (float) $od['o1'],
'd3w' => (float) $od['o2'],
'a3w' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
'book_startime' => $od['@attributes']['starting_time'],
'source_updated_at' => $od['@attributes']['time'],
'nuh_last_check' => Carbon::now()->toDateTimeString(),
];
Odds3way::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
],
[
'start' => $od['@attributes']['starting_time'],
'h3w' => (float) $od['o1'],
'd3w' => (float) $od['o2'],
'a3w' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
case '1':
Odds2way::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
],
[
'start' => $od['@attributes']['starting_time'],
'h2w' => (float) $od['o1'],
'a2w' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
case '4':
// totals
$e['odds_totals'][] = [
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'matchpart_id' => 1,
'sport_id' => 1,
'bmoid' => $bmoid,
'over' => (float) $od['o1'],
'under' => (float) $od['o2'],
'spread' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2']], 1),
'flag' => 1,
'check' => 0,
'book_startime' => $od['@attributes']['starting_time'],
'source_updated_at' => $od['@attributes']['time'],
'nuh_last_check' => Carbon::now()->toDateTimeString(),
];
OddsTotal::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
'spread' => (float) $od['o3'],
],
[
'start' => $od['@attributes']['starting_time'],
'over' => (float) $od['o1'],
'under' => (float) $od['o2'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
case '5242880':
// double chance
$e['odds_dc'][] = [
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'matchpart_id' => 1,
'sport_id' => 1,
'bmoid' => $bmoid,
'dc1x' => (float) $od['o1'],
'dc12' => (float) $od['o2'],
'dc2x' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
'book_startime' => $od['@attributes']['starting_time'],
'source_updated_at' => $od['@attributes']['time'],
'nuh_last_check' => Carbon::now()->toDateTimeString(),
];
OddsDc::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
],
[
'start' => $od['@attributes']['starting_time'],
'dc1x' => (float) $od['o1'],
'dc12' => (float) $od['o2'],
'dc2x' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
case '11534337':
OddsGgng::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
],
[
'start' => $od['@attributes']['starting_time'],
'gg' => (float) $od['o1'],
'ng' => (float) $od['o3'],
'margin' => (float) Helper::margin([$od['o1'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
case '11534337':
OddsQualify::updateOrCreate(
[
'event_id' => $e['id'],
'bookmaker_id' => $bkmid,
'sport_id' => NuhBash::$options['sport_id'],
'bmoid' => $bmoid,
],
[
'start' => $od['@attributes']['starting_time'],
'htq' => (float) $od['o1'],
'atq' => (float) $od['o2'],
'margin' => (float) Helper::margin([$od['o1'], $od['o3']], 1),
'flag' => 1,
'check' => 0,
'source_updated_at' => $od['@attributes']['time'],
'last_check_at' => Carbon::now()->toDateTimeString(),
]
);
break;
}
@@ -247,124 +323,6 @@ class Odds
break;
}
}
dd($e);
// if (NuhBash::$options['d']) {
// Notice::note((int) $row['id'].' : '.$row->hteam.' - '.$row->ateam, 'b', 1);
// }
// dd($data);
// if (NuhBash::$options['p']) {
// Notice::note($url);
// foreach ($xml->match as $match) {
// print_r($match);
// }
// exit;
// }
// foreach ($xml->match as $m) {
// if (NuhBash::$options['d']) {
// Notice::note((int) $m['id'].' : '.$m->hteam.' - '.$m->ateam);
// }
// $evid = Event::where('txid', (int) $m['id'])->pluck('id')->first();
// if ($evid) {
// $fixed_array = [];
// $fixed_array['event_id'] = $evid;
// Event::where('id', $evid)->update(['cnt_bkm_tx' => count($m->bookmaker)]);
// foreach ($m->bookmaker as $bookmaker) {
// $fixed_array['bkid'] = (int) $bookmaker['bid'];
// $value_array = [];
// foreach ($bookmaker->offer as $offer) {
// switch ($offer['ot']) {
// case '0':
// $value_array['f3w'] = (int) $offer['flags'] ?? 0;
// $value_array['boid'] = (string) $offer['bmoid'] ?? 0;
// $value_array['time'] = Carbon::parse($offer->odds['starting_time'])->toDateTimeString();
// $tmp = [];
// $tmp['h3w'] = (float) $offer->odds->o1 ?? 1;
// $tmp['d3w'] = (float) $offer->odds->o2 ?? 1;
// $tmp['a3w'] = (float) $offer->odds->o3 ?? 1;
// $tmp['m3w'] = Helper::margin($tmp);
// $value_array += $tmp;
// break;
// case '1':
// $value_array['f2w'] = (int) $offer['flags'] ?? 0;
// $value_array['boid'] = (string) $offer['bmoid'] ?? 0;
// $value_array['time'] = Carbon::parse($offer->odds['starting_time'])->toDateTimeString();
// $tmp = [];
// $tmp['h2w'] = (float) $offer->odds->o1 ?? 1;
// $tmp['a2w'] = (float) $offer->odds->o3 ?? 1;
// $tmp['m2w'] = Helper::margin($tmp);
// $value_array += $tmp;
// break;
// case '4':
// $hc = (float) $offer->odds->o3;
// if (NuhBash::$options['sport_id'] == 1 && $hc == 2.5) {
// $tmp = [];
// $tmp['ov'] = (float) $offer->odds->o1 ?? 1;
// $tmp['un'] = (float) $offer->odds->o2 ?? 1;
// $tmp['mto'] = Helper::margin($tmp);
// $tmp['fto'] = (int) $offer->odd['flags'] ?? 0;
// $tmp['hc'] = 2.5;
// $value_array += $tmp;
// }
// break;
// case '5242880':
// // Double Chance (dc1x,dc12,dcx2)
// $value_array['fdc'] = (int) $offer['flags'] ?? 0;
// $tmp = [];
// $tmp['dc1x'] = (float) $offer->odds->o1 ?? 1;
// $tmp['dc12'] = (float) $offer->odds->o2 ?? 1;
// $tmp['dcx2'] = (float) $offer->odds->o3 ?? 1;
// $tmp['mdc'] = Helper::margin($tmp);
// $value_array += $tmp;
// break;
// case '11534337':
// // goal/nogoal (gg,ng)
// $value_array['fgg'] = (int) $offer['flags'] ?? 0;
// $tmp = [];
// $tmp['gg'] = (float) $offer->odds->o1 ?? 1;
// $tmp['ng'] = (float) $offer->odds->o3 ?? 1;
// $tmp['mgg'] = Helper::margin($tmp);
// $value_array += $tmp;
// break;
// case '7340033':
// // to qualify (htq,atq)
// $value_array['ftq'] = (int) $offer['flags'] ?? 0;
// $tmp = [];
// $tmp['htq'] = (float) $offer->odds->o1 ?? 1;
// $tmp['atq'] = (float) $offer->odds->o3 ?? 1;
// $tmp['mtq'] = Helper::margin($tmp);
// $value_array += $tmp;
// break;
// }
// }
// EventBookmaker::updateOrCreate($fixed_array, $value_array);
// if (NuhBash::$options['d']) {
// Notice::note($fixed_array + $value_array, 'b');
// }
// }
// }
// }
}
}
}
+4 -4
View File
@@ -13,11 +13,11 @@ class TxSwitch
*/
public static function switch()
{
switch (NuhBash::$options['id']) {
case 1:
switch (NuhBash::$options['name']) {
case 'Fixtures':
Fixtures::grap();
break;
case 2:
case 'Odds':
Odds::grap();
break;
case 3:
@@ -27,7 +27,7 @@ class TxSwitch
case 5:
break;
default:
Note::notice('wrong process id for txodds', 'r', 1);
Note::notice('prosses name does not exist', 'r', 1);
break;
}
}
+15 -19
View File
@@ -20,9 +20,9 @@ class NuhBash extends Command
public function handle()
{
self::$options = $this->options();
self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid');
$queries = self::$options['m'] ?? 0;
if ($this->argument('process') == 'help') {
@@ -59,25 +59,21 @@ class NuhBash extends Command
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;
if (! self::$options['is_active']) {
Notice::note('Process disabled', 'r', 1);
}
case 'Comparatore':
// code...
switch (self::$options['provider_id']) {
case 1:
// direct
break;
case 2:
TxSwitch::switch();
case 3:
// betsapi
break;
default:
Note::notice('Provider not defined', 'r', 1);
break;
}