rapper magloo nigeria fixtures ok

This commit is contained in:
salam committed 2026-01-03 12:29:17 +01:00
1 parent 34690292aa
commit 9e7384daf8
46 files changed
+334 -1502

No files matched your search

+90 -78
View File
@@ -11,6 +11,7 @@ use App\Models\OddsDnb;
use App\Models\OddsGgng;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class Bet365
@@ -18,16 +19,25 @@ class Bet365
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$break = Nuh::$options['b'] ?? 0;
$week = Nuh::$options['w'] ?? 0;
/**
* Bet365
*/
$bookmaker_id = 126;
$events = Event::where('bet365_id', '>', 0)->where('events.starttime', '>', Carbon::now())->get();
$events = Event::where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
foreach ($events as $event) {
foreach ($events as $key => $event) {
if ($debug) {
Notice::note([
'id' => $event->id,
'bet365_id' => $event->bet365_id,
'starttime' => $event->starttime,
'count' => count($events).'/'.$key + 1,
], 'b');
}
/**
* BET365 ODDS (per event)
*/
@@ -35,93 +45,95 @@ class Bet365
$data = Curl::load($url);
$offer = $data['results'][0]['main']['sp'];
if (isset($data['results'][0]['main'])) {
$base = [];
$base['sport_id'] = $event->sport_id;
$base['provider_id'] = Nuh::$options['provider_id'];
$base['bmoid'] = $event->bet365_id;
$base['flag'] = 1;
$base['last_check_at'] = Carbon::now();
$offer = $data['results'][0]['main']['sp'];
/**
* 1X2
*/
if (isset($offer['full_time_result'])) {
$odds = [];
$odds['h3w'] = $offer['full_time_result']['odds'][0]['odds'] ?? 1;
$odds['d3w'] = $offer['full_time_result']['odds'][1]['odds'] ?? 1;
$odds['a3w'] = $offer['full_time_result']['odds'][2]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$base = [];
$base['sport_id'] = $event->sport_id;
$base['provider_id'] = Nuh::$options['provider_id'];
$base['bmoid'] = $event->bet365_id;
$base['flag'] = 1;
Odds3way::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
/**
* 1X2
*/
if (isset($offer['full_time_result'])) {
$odds = [];
$odds['h3w'] = $offer['full_time_result']['odds'][0]['odds'] ?? 1;
$odds['d3w'] = $offer['full_time_result']['odds'][1]['odds'] ?? 1;
$odds['a3w'] = $offer['full_time_result']['odds'][2]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
/**
* DC
*/
if (isset($offer['double_chance'])) {
$odds = [];
$odds['dc1x'] = $offer['double_chance']['odds'][0]['odds'] ?? 1;
$odds['dc12'] = $offer['double_chance']['odds'][1]['odds'] ?? 1;
$odds['dcx2'] = $offer['double_chance']['odds'][2]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDc::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
/**
* OU
*/
if (isset($offer['goals_over_under'])) {
$odds = [];
$odds['over'] = $offer['goals_over_under']['odds'][0]['odds'] ?? 1;
$odds['under'] = $offer['goals_over_under']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
if ((float) $offer['goals_over_under']['odds'][1]['name'] == 2.5) {
OddsTotal::updateOrCreate([
Odds3way::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
'total' => 2.5,
], $base + $odds);
}
}
/**
* GG NG
*/
if (isset($offer['both_teams_to_score'])) {
$odds = [];
$odds['gg'] = $offer['both_teams_to_score']['odds'][0]['odds'] ?? 1;
$odds['ng'] = $offer['both_teams_to_score']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
/**
* DC
*/
if (isset($offer['double_chance'])) {
$odds = [];
$odds['dc1x'] = $offer['double_chance']['odds'][0]['odds'] ?? 1;
$odds['dc12'] = $offer['double_chance']['odds'][1]['odds'] ?? 1;
$odds['dcx2'] = $offer['double_chance']['odds'][2]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsGgng::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
OddsDc::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
/**
* DNB
*/
if (isset($offer['draw_no_bet'])) {
$odds = [];
$odds['dnb1'] = $offer['draw_no_bet']['odds'][0]['odds'] ?? 1;
$odds['dnb2'] = $offer['draw_no_bet']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
/**
* OU
*/
if (isset($offer['goals_over_under'])) {
$odds = [];
$odds['over'] = $offer['goals_over_under']['odds'][0]['odds'] ?? 1;
$odds['under'] = $offer['goals_over_under']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDnb::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
if ((float) $offer['goals_over_under']['odds'][1]['name'] == 2.5) {
OddsTotal::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
'total' => 2.5,
], $base + $odds);
}
}
/**
* GG NG
*/
if (isset($offer['both_teams_to_score'])) {
$odds = [];
$odds['gg'] = $offer['both_teams_to_score']['odds'][0]['odds'] ?? 1;
$odds['ng'] = $offer['both_teams_to_score']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsGgng::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
/**
* DNB
*/
if (isset($offer['draw_no_bet'])) {
$odds = [];
$odds['dnb1'] = $offer['draw_no_bet']['odds'][0]['odds'] ?? 1;
$odds['dnb2'] = $offer['draw_no_bet']['odds'][1]['odds'] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDnb::updateOrCreate([
'event_id' => $event->id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
}
}
}
}
@@ -4,7 +4,7 @@ namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Mapper\FindEvent;
use App\Mapper\FindFixture;
use App\Mapper\LoadElements;
use App\Mapper\LoadGroups;
use App\Models\Mapper;
@@ -95,7 +95,7 @@ class Fixtures
'group_cc' => strtoupper($row['league']['cc']) ?? '',
];
FindEvent::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
FindFixture::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
}
}
}
-3
View File
@@ -11,9 +11,6 @@ class Magloo
{
public static function switch()
{
Nuh::$options['proxy'] = 'https://proxydb1.nuhodds.com/MaglooProxy.php';
switch (Nuh::$options['name']) {
case 'Fixtures':
Fixtures::grap();
@@ -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]);
}
}
}
}
}
@@ -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:
@@ -216,7 +216,6 @@ class Odds
$odds['flag'] = 1;
$odds['provider_id'] = Nuh::$options['provider_id'];
$odds['nuh_check'] = 0;
$odds['last_check_at'] = Carbon::now()->toDateTimeString();
foreach ($book->offer as $offer) {
@@ -11,11 +11,11 @@ class _3Way
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('1X2 '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('1X2 '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['h3w'] = (float) $value->o1;
@@ -11,11 +11,11 @@ class _Dc
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Double Chance '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('Double Chance '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['dc1x'] = (float) $value->o1;
@@ -11,11 +11,11 @@ class _Dnb
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Draw No Bet '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('Draw No Bet '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['dnb1'] = (float) $value->o1;
@@ -11,11 +11,11 @@ class _Ggng
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Goal No Goal '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('Goal No Goal '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['gg'] = (float) $value->o1;
@@ -11,11 +11,11 @@ class _Totals
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('Totals '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('Totals '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['over'] = (float) $value->o1;
@@ -11,11 +11,11 @@ class _Tq
{
public static function grap($odds, $offer)
{
$debug = Nuh::$options['d'] ?? 0;
// $debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('To Qualify '.Nuh::$bookmaker_id, 'b');
}
// if ($debug) {
// Notice::note('To Qualify '.Nuh::$bookmaker_id, 'b');
// }
foreach ($offer as $value) {
$odds['htq'] = (float) $value->o1;
+1 -1
View File
@@ -51,7 +51,7 @@ class Nuh extends Command
$txt .= '--e echo file'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--p use proxy db1'.PHP_EOL;
$txt .= '--p use proxy'.PHP_EOL;
$txt .= '--q print queries'.PHP_EOL;
$txt .= '--r read data from file '.PHP_EOL;
File diff suppressed because it is too large. Load diff