rapper magloo nigeria fixtures ok
This commit is contained in:
1 parent
34690292aa
commit
9e7384daf8
46 files changed
+334
-1502
No files matched your search
@@ -3,25 +3,106 @@
|
||||
namespace App\Console\Commands\Grapper\Magloo;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\BaseUrl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mapper\FindFixture;
|
||||
use App\Mapper\LoadElements;
|
||||
use App\Mapper\LoadGroups;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Fixtures
|
||||
{
|
||||
public static $elements = [];
|
||||
|
||||
public static $groups = [];
|
||||
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$test = Nuh::$options['t'] ?? 0;
|
||||
$echo = Nuh::$options['e'] ?? 0;
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
dd(Nuh::$options);
|
||||
$sportmap = Sport::map('magl', 1, [1, 3]);
|
||||
|
||||
$sportmap = Sport::map('magl');
|
||||
self::$elements = LoadElements::load(Nuh::$options['provider_id']);
|
||||
|
||||
$url = Url::sports();
|
||||
self::$groups = LoadGroups::load(Nuh::$options['provider_id']);
|
||||
|
||||
$file = Curl::load($url);
|
||||
if ($proxy) {
|
||||
Notice::note('PROXY USED', 'r');
|
||||
}
|
||||
|
||||
dd($file);
|
||||
if ($debug) {
|
||||
Notice::note('FIXTURES '.Nuh::$options['process'], 'b');
|
||||
}
|
||||
|
||||
$base_url = BaseUrl::get();
|
||||
|
||||
/**
|
||||
* Tornaments
|
||||
*/
|
||||
$url = $base_url.'/sport';
|
||||
$data = Curl::load($url);
|
||||
if (! is_array($data) or \count($data) == 0) {
|
||||
Notice::note('no data in feed', 'r', 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$ligas = [];
|
||||
foreach ($data as $value) {
|
||||
$magloo_sport_id = (int) $value['i'];
|
||||
if (array_key_exists($magloo_sport_id, $sportmap)) {
|
||||
$tmp = [];
|
||||
$tmp['sport'] = $value['n'];
|
||||
$tmp['sport_id'] = $sportmap[$magloo_sport_id];
|
||||
$tmp['magloo_sport_id'] = $magloo_sport_id;
|
||||
foreach ($value['C'] as $key => $val1) {
|
||||
$tmp['country_id'] = $val1['i'];
|
||||
$tmp['country'] = $val1['n'];
|
||||
foreach ($val1['T'] as $key => $val2) {
|
||||
$tmp['group_id'] = $val2['i'];
|
||||
$tmp['group'] = $val2['n'];
|
||||
$ligas[] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($ligas as $liga) {
|
||||
if ($liga['group'] && strpos($liga['group'], 'Simulated') === false) {
|
||||
|
||||
$sport_id = $liga['sport_id'];
|
||||
|
||||
$url = $base_url.'/tournament/'.$liga['group_id'].'/event';
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
foreach ($data as $magloo) {
|
||||
|
||||
// print_r($magloo);
|
||||
|
||||
$event = [];
|
||||
$event['event_id'] = (int) $magloo['i'];
|
||||
$event['betradar_id'] = (int) preg_replace('/\D/', '', $magloo['p']);
|
||||
$event['sport_id'] = $sport_id;
|
||||
$event['provider_id'] = Nuh::$options['provider_id'];
|
||||
$event['starttime'] = strtotime($magloo['dt']);
|
||||
$event['country_id'] = $liga['country_id'];
|
||||
$event['country'] = $liga['country'];
|
||||
$event['group_id'] = $liga['group_id'];
|
||||
$event['group'] = $liga['group'];
|
||||
$event['starttime'] = Carbon::parse($magloo['dt'])->toDateTimeString();
|
||||
$teams = explode(' v ', str_replace('|', ' ', $magloo['n']));
|
||||
$event['home_id'] = $magloo['htId'];
|
||||
$event['home'] = addslashes($teams[0]);
|
||||
$event['away_id'] = $magloo['atId'];
|
||||
$event['away'] = addslashes($teams[1]);
|
||||
|
||||
FindFixture::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo;
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Url
|
||||
class BaseUrl
|
||||
{
|
||||
public static function sports()
|
||||
public static function get()
|
||||
{
|
||||
$test = Nuh::$options['t'] ?? 0;
|
||||
|
||||
@@ -15,17 +15,17 @@ class Url
|
||||
case 3:
|
||||
// KENIA
|
||||
if ($test) {
|
||||
return 'https://int.external.api.algorez.com/api/sb/affiliates/30/en/1/prematch/sport';
|
||||
return 'https://int.external.api.algorez.com/api/sb/affiliates/30/en/1/prematch';
|
||||
} else {
|
||||
return 'https://api.externalsvc.com/api/sb/affiliates/30/en/1/prematch/sport';
|
||||
return 'https://api.externalsvc.com/api/sb/affiliates/30/en/1/prematch';
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// NIGERIA
|
||||
if ($test) {
|
||||
return 'https://int.external.api.algorez.com/api/sb/affiliates/20/en/1/prematch/sport';
|
||||
return 'https://int.external.api.algorez.com/api/sb/affiliates/20/en/1/prematch';
|
||||
} else {
|
||||
return 'https://api.externalsvc.com/api/sb/affiliates/20/en/1/prematch/sport';
|
||||
return 'https://api.externalsvc.com/api/sb/affiliates/20/en/1/prematch';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Reference in new issue
Block a user