This commit is contained in:
salam committed 2025-12-18 19:22:36 +01:00
1 parent 60379bcab8
commit 5c9745b1da
19 files changed
+167 -105

No files matched your search

+13 -6
View File
@@ -8,11 +8,11 @@ class Curl
{
public static $file;
public static function load($url)
public static function load($url, $proxy = false)
{
$debug = NuhBash::$options['d'] ?? 0;
$save = NuhBash::$options['s'] ?? 0;
$read = NuhBash::$options['r'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$save = Nuh::$options['s'] ?? 0;
$read = Nuh::$options['r'] ?? 0;
if ($debug) {
Notice::note($url);
@@ -22,7 +22,7 @@ class Curl
if ($debug) {
Notice::note('READ LOCAL', 'r');
}
$filename = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', NuhBash::$options['name'])).'.json';
$filename = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
$file = file_get_contents($filename);
@@ -34,6 +34,13 @@ class Curl
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
if ($proxy) {
curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($request, CURLOPT_HTTPHEADER, [
'Proxy-Auth: $2y$12$/iKduDrM9HJA6T6t/5e5x.nkQ9KUNWLvTXhRwdU.EN2Twfwlr4jzu',
'Proxy-Target-URL: '.$url,
]);
}
$data = curl_exec($ch);
$curl_errorno = curl_errno($ch);
if ($curl_errorno) {
@@ -46,7 +53,7 @@ class Curl
if ($save) {
Notice::note('SAVED LOCAL', 'b');
self::$file = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', NuhBash::$options['name'])).'.json';
self::$file = app_path().'/Console/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
file_put_contents(self::$file, $data);
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Nuh;
use App\Models\Sport;
use App\Utilities\Notice;
class Magloo
{
public static function switch()
{
$sportmap = Sport::map('magl');
dd($sportmap);
switch (Nuh::$options['sport_id']) {
case 1:
Fixtures::grap();
break;
case 3:
break;
case 4:
break;
case 5:
break;
default:
Notice::note('prosses name does not exist', 'r', 1);
break;
}
}
}
@@ -4,20 +4,20 @@ namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\TxOdds\Fixtures;
use App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
class TxSwitch
class TxOdds
{
public static function switch()
{
if (NuhBash::$options['sport_id'] == 1) {
NuhBash::$AUTHTOKEN = 'ident=betaid1&passwd=Dy59vpRC';
if (Nuh::$options['sport_id'] == 1) {
Nuh::$AUTHTOKEN = 'ident=betaid1&passwd=Dy59vpRC';
} else {
NuhBash::$AUTHTOKEN = 'ident=betaid2&passwd=Dy59vpRC';
Nuh::$AUTHTOKEN = 'ident=betaid2&passwd=Dy59vpRC';
}
switch (NuhBash::$options['name']) {
switch (Nuh::$options['name']) {
case 'Fixtures':
Fixtures::grap();
break;
@@ -3,7 +3,7 @@
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Curl;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\Country;
use App\Utilities\Notice;
@@ -11,8 +11,8 @@ class Countries
{
public static function call()
{
$debug = NuhBash::$options['d'] ?? 0;
$print = NuhBash::$options['p'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$print = Nuh::$options['p'] ?? 0;
$url = 'https://xml2.txodds.com/feed/countries.php';
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\CompetitionGroup;
use App\Models\Element;
@@ -15,9 +15,9 @@ class Fixtures
{
public static function grap()
{
$debug = NuhBash::$options['d'] ?? 0;
$print = NuhBash::$options['p'] ?? 0;
$break = NuhBash::$options['b'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
$break = Nuh::$options['b'] ?? 0;
$count = 0;
$total = 0;
@@ -40,11 +40,11 @@ class Fixtures
$from = $now->addDays($i)->toDateString();
$to = $now->addDays($i + 1)->toDateString();
$url = 'https://xml2.txodds.com/feed/result/xml.php?'.NuhBash::$AUTHTOKEN."&date=$from,$to";
$url = 'https://xml2.txodds.com/feed/result/xml.php?'.Nuh::$AUTHTOKEN."&date=$from,$to";
$data = Xml::load($url);
if ($print) {
if ($echo) {
dd($data);
}
+26 -22
View File
@@ -8,7 +8,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\_Dnb;
use App\Console\Commands\Grapper\TxOdds\Odds\_Ggng;
use App\Console\Commands\Grapper\TxOdds\Odds\_Totals;
use App\Console\Commands\Grapper\TxOdds\Odds\_Tq;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\CompetitionGroup;
use App\Models\Element;
@@ -23,10 +23,10 @@ class Odds
public static function grap()
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('txodd odd sport: '.NuhBash::$options['sport_id'], 'b');
Notice::note('txodd odd sport: '.Nuh::$options['sport_id'], 'b');
}
/*************************************************
@@ -79,9 +79,10 @@ class Odds
*************************************************/
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
switch (NuhBash::$options['sport_id']) {
switch (Nuh::$options['sport_id']) {
case 1:
$markets = '0,4,11534337,5242880,7340033,6291457';
break;
@@ -107,22 +108,22 @@ class Odds
/*************************************************
* URL
*************************************************/
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.NuhBash::$AUTHTOKEN.'&all_odds=2&spid='.NuhBash::$options['sport_id'];
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&spid='.Nuh::$options['sport_id'];
$_calls = [];
if (NuhBash::$options['event_id']) {
$_calls[] = $url."&ot=$markets&peid=".NuhBash::$options['event_id'];
} elseif (NuhBash::$options['a']) {
if (Nuh::$options['event_id']) {
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['event_id'];
} elseif (Nuh::$options['a']) {
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('tx_id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} elseif (NuhBash::$options['w']) {
} elseif (Nuh::$options['w']) {
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('tx_id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} else {
$_calls[] = $url.'&last='.NuhBash::$options['lastcall'];
$_calls[] = $url.'&last='.Nuh::$options['lastcall'];
}
/*************************************************
@@ -132,6 +133,10 @@ class Odds
$data = Xml::load($url);
if ($echo) {
dd($data);
}
foreach ($data as $row) {
$event = [];
@@ -177,19 +182,18 @@ class Odds
'sport_id' => $event['sport_id'],
]);
NuhBash::$_event = Event::firstOrCreate($event, ['starttime' => $event['starttime']]);
Nuh::$_event = Event::firstOrCreate($event, ['starttime' => $event['starttime']]);
foreach ($row->bookmaker as $book) {
NuhBash::$bookmaker_id = (int) $book['bid'];
Nuh::$bookmaker_id = (int) $book['bid'];
NuhBash::$bookmaker_id = (int) $book['bid'];
Nuh::$bookmaker_id = (int) $book['bid'];
$odds = [];
$odds['sport_id'] = (int) $event['sport_id'];
$odds['provider_id'] = 2;
NuhBash::$_event_bookmaker = [];
Nuh::$_event_bookmaker = [];
foreach ($book->offer as $offer) {
@@ -238,15 +242,15 @@ class Odds
}
}
foreach (NuhBash::$_event_bookmaker as $value) {
foreach (Nuh::$_event_bookmaker as $value) {
EventBookmaker::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
'bookmaker_id' => Nuh::$bookmaker_id,
], [
'bmoid' => $value['bmoid'],
'provider_id' => 2,
'provider_id' => Nuh::$options['provider_id'],
'bkm_starttime' => Carbon::createFromDate($value['starttime'])->toDateTimeString(),
'last_check_at' => Carbon::now()->toDateTimeString(),
]);
@@ -255,7 +259,7 @@ class Odds
}
if ($debug) {
Notice::note('END '.NuhBash::$_event->id, 'g');
Notice::note('END '.Nuh::$_event->id, 'g');
Notice::note('END', 'g');
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _3Way
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('1X2 '.NuhBash::$bookmaker_id, 'b');
Notice::note('1X2 '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -27,7 +27,7 @@ class _3Way
$bkm_starttime = (string) $value['starting_time'];
}
NuhBash::$_event_bookmaker[] =
Nuh::$_event_bookmaker[] =
[
'bmoid' => $odds['bmoid'],
'starttime' => $bkm_starttime,
@@ -37,14 +37,14 @@ class _3Way
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
Odds3way::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\OddsDc;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _Dc
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Double Chance '.NuhBash::$bookmaker_id, 'b');
Notice::note('Double Chance '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -30,14 +30,14 @@ class _Dc
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsDc::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\OddsDnb;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _Dnb
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Draw No Bet '.NuhBash::$bookmaker_id, 'b');
Notice::note('Draw No Bet '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -29,14 +29,14 @@ class _Dnb
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsDnb::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\OddsGgng;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _Ggng
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Goal No Goal '.NuhBash::$bookmaker_id, 'b');
Notice::note('Goal No Goal '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -29,14 +29,14 @@ class _Ggng
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsGgng::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _Totals
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Totals '.NuhBash::$bookmaker_id, 'b');
Notice::note('Totals '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -38,14 +38,14 @@ class _Totals
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsTotal::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Console\Commands\Nuh;
use App\Models\OddsQualify;
use App\Utilities\Margin;
use App\Utilities\Notice;
@@ -12,10 +12,10 @@ class _Tq
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('To Qualify '.NuhBash::$bookmaker_id, 'b');
Notice::note('To Qualify '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
@@ -29,14 +29,14 @@ class _Tq
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['provider_id'] = Nuh::$options['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsQualify::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
}
}
@@ -2,14 +2,15 @@
namespace App\Console\Commands;
use App\Console\Commands\Grapper\TxSwitch;
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 NuhBash extends Command
class Nuh extends Command
{
public static $options = [];
@@ -25,7 +26,7 @@ class NuhBash extends Command
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--w} {--p} {--s} {--r} {--b} {--q}';
protected $description = 'NuhBash';
protected $description = 'Nuh';
public function handle()
{
@@ -49,7 +50,8 @@ class NuhBash extends Command
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--w reload one week'.PHP_EOL;
$txt .= '--p print grapped file'.PHP_EOL;
$txt .= '--p use proydb1'.PHP_EOL;
$txt .= '--e echo file'.PHP_EOL;
$txt .= '--s store data to file '.PHP_EOL;
$txt .= '--r read data from file '.PHP_EOL;
$txt .= '--b break loop after one '.PHP_EOL;
@@ -75,13 +77,23 @@ class NuhBash extends Command
switch (self::$options['provider_id']) {
case 1:
// direct
break;
TxOdds::switch();
case 2:
TxSwitch::switch();
case 3:
// 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;
+4 -4
View File
@@ -10,11 +10,11 @@ class Xml
public static function load($url)
{
$debug = NuhBash::$options['d'] ?? 0;
$save = NuhBash::$options['s'] ?? 0;
$read = NuhBash::$options['r'] ?? 0;
$debug = Nuh::$options['d'] ?? 0;
$save = Nuh::$options['s'] ?? 0;
$read = Nuh::$options['r'] ?? 0;
$filename = app_path().'/Console/Commands/TestFiles/'.strtolower(str_replace(' ', '_', NuhBash::$options['name'])).'.xml';
$filename = app_path().'/Console/Commands/TestFiles/'.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.xml';
if ($debug) {
Notice::note("Loading URL\n".$url);
+9 -1
View File
@@ -2,9 +2,17 @@
namespace App\Models;
use App\Utilities\Notice;
use Illuminate\Database\Eloquent\Model;
class Sport extends Model
{
//
public static function map($field)
{
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl'])) {
Notice::note('Wrong Option! Possible options: bapi, bwin, b365, logi, magl', 'r', 1);
}
return Sport::select($field, 'id')->where('is_active', 1)->get()->useKey('id')->toArray();
}
}