grapper betsapi

This commit is contained in:
salam committed 2025-12-22 08:15:59 +01:00
1 parent 406fd26864
commit a3c9f16550
127 files changed
+158128 -650

No files matched your search

+9 -3
View File
@@ -2,8 +2,8 @@
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Betsapi\Bwin;
use App\Console\Commands\Grapper\Betsapi\Fixtures;
use App\Console\Commands\Grapper\Betsapi\IdMapper;
use App\Console\Commands\Grapper\Betsapi\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
@@ -20,8 +20,14 @@ class Betsapi
case 'Odds':
Odds::grap();
break;
case 'IdMapper':
IdMapper::grap();
case 'Willhill':
Willhill::grap();
break;
case 'Bwin':
Bwin::grap();
break;
case 'Bwin':
Bet365::grap();
break;
default:
Notice::note('prosses name does not exist', 'r', 1);
@@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Utilities\Notice;
class Bet365
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
/**
* Bet365
*/
$bookmaker_id = 126;
$res = Event::where('bet365_id', '>', 0)->pluck('id', 'bet365_id');
foreach ($res as $bet365_id => $txodds_id) {
/**
* BET365 ODDS (per event)
*/
$url = 'https://api.b365api.com/v4/bet365/prematch?token='.config('env.betsapi_token').'&FI='.$bet365_id;
$data = Curl::load($url);
dd($data);
$betsapi_id = $data['results'][0]['id'] ?? 0;
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
if ($debug) {
Notice::note(["TXdds ID : $txodds_id", "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", "Willhill ID : $willhill_id"], 'b');
}
if ($betsapi_id) {
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
}
}
}
}
@@ -0,0 +1,47 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Utilities\Notice;
class Betfair
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
/**
* Bet365
*/
$bookmaker_id = 126;
$res = Event::where('bet365_id', '>', 0)->pluck('id', 'bet365_id');
foreach ($res as $bet365_id => $txodds_id) {
/**
* BETFAIR SP (per page)
* https://api.b365api.com/v1/bwin/prematch?token=36152-aeTRNnZxSPUwGe
*/
$url = 'https://api.b365api.com/v4/bet365/prematch?token='.config('env.betsapi_token').'&FI='.$bet365_id;
$data = Curl::load($url);
dd($data);
$betsapi_id = $data['results'][0]['id'] ?? 0;
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
if ($debug) {
Notice::note(["TXdds ID : $txodds_id", "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", "Willhill ID : $willhill_id"], 'b');
}
if ($betsapi_id) {
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
}
}
}
}
@@ -0,0 +1,61 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use App\Utilities\Notice;
class Bwin
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$sportmap = Sport::map('bwin');
$total = 1;
foreach ($sportmap as $sport_id => $bwin_sport_id) {
$page = 1;
/**
* BWIN ODDS & BETRADAR ID (per page)
*/
$url = 'https://api.b365api.com/v1/bwin/prematch?token='.config('env.betsapi_token').'&page=###page###&sport_id='.$bwin_sport_id;
while ($page <= $total) {
$url = str_replace('###page###', $page, $url);
$data = Curl::load($url);
$page++;
$total = round($data['pager']['total'] / $data['pager']['per_page']);
if ($debug) {
Notice::note("Page: $page \nTotal: $total");
}
if (isset($data['results'])) {
foreach ($data['results'] as $event) {
$bwin_id = $event['Id'];
$betradar_id = $event['BetRadarId'] ?? 0;
$betsapi_id = $event['our_event_id'];
if ($betradar_id) {
Event::where('betsapi_id', (int) $betsapi_id)->update(['betradar_id' => $betradar_id, 'bwin_id' => $bwin_id]);
Mapper::where('event_id', $betsapi_id)->delete();
}
}
}
}
}
}
}
@@ -14,12 +14,10 @@ class Fixtures
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$test = Nuh::$options['t'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
$sportmap = Sport::map('bapi');
$total = 10;
$total = 1;
foreach ($sportmap as $sport_id => $betsapi_sport_id) {
$page = 1;
while ($page <= $total) {
@@ -41,7 +39,7 @@ class Fixtures
foreach ($data['results'] as $row) {
$event = [
'sport_id' => (int) $row['sport_id'],
'sport_id' => (int) $sport_id,
'provider_id' => (int) Nuh::$options['provider_id'],
'starttime' => Carbon::createFromTimestamp((string) $row['time'])->toDateTimeString(),
'home' => $row['home']['name'] ?? '',
@@ -55,7 +53,7 @@ class Fixtures
'group_cc' => $row['league']['cc'] ?? '',
];
Mapper::updateOrCreate(['betsapi_id' => (int) $row['id']], $event);
Mapper::updateOrCreate(['event_id' => (int) $row['id']], $event);
}
}
}
@@ -1,73 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Mapper;
use App\Utilities\Notice;
class IdMapper
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$test = Nuh::$options['t'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
$total = 10;
$bookmakers = [[
'name' => 'betfair',
'url' => 'https://api.b365api.com/v1/betfair/sb/upcoming?sport_id=###sport_id###&page=###page###',
], [
'name' => '1xbet',
'url' => 'https://api.b365api.com/v1/1xbet/upcoming?sport_id=###sport_id###&page=###page###',
]];
foreach ($bookmakers as $bookmaker) {
if ($bookmaker['name'] == '1xbet') {
// same like txodds
$sportmap = [1, 2, 3];
} elseif ($bookmaker['name'] == 'betfair') {
// 1 soccer
// 7522 basketball
$sportmap = [1, 7522];
}
foreach ($sportmap as $sport_id) {
$page = 1;
$url = str_replace('###sport_id###', $sport_id, $bookmaker['url']).'&token='.config('env.betsapi_token');
while ($page <= $total) {
$url = str_replace('###page###', $page, $url);
$data = Curl::load($url);
$page++;
$total = round($data['pager']['total'] / $data['pager']['per_page']);
if ($debug) {
Notice::note("Page: $page \nTotal: $total");
}
if (isset($data['results'])) {
foreach ($data['results'] as $row) {
if ($bookmaker['name'] == '1xbet') {
Mapper::where('betsapi_id', (int) $row['our_event_id'])->update(['_1xbet_id' => (int) $row['id']]);
} elseif ($bookmaker['name'] == 'betfair') {
Mapper::where('betsapi_id', (int) $row['our_event_id'])->update(['betfairsb_id' => (int) $row['id']]);
}
}
}
}
}
}
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Odds3way;
use App\Utilities\Notice;
class Willhill
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
/**
* williamhill
*/
$bookmaker_id = 42;
$res = Odds3way::join('events', 'odds_3ways.event_id', 'events.id')
->where('odds_3ways.bookmaker_id', $bookmaker_id)
->where('events.betsapi_id', 0)
->where('odds_3ways.bmoid', '>', 0)->pluck('odds_3ways.event_id', 'odds_3ways.bmoid');
foreach ($res as $willhill_id => $txodds_id) {
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id;
$data = Curl::load($url);
$betsapi_id = $data['results'][0]['id'] ?? 0;
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
if ($debug) {
Notice::note(["TXdds ID : $txodds_id", "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", "Willhill ID : $willhill_id"], 'b');
}
if ($betsapi_id) {
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
Mapper::where('event_id', $betsapi_id)->delete();
}
}
}
}
@@ -49,61 +49,46 @@ class Fixtures
}
foreach ($data as $row) {
// <match id="14563695" xsid="0" gsmid="0" last_updated="2025-12-02T08:31:11+00:00">
// <time>2025-12-03T22:30:00+00:00</time>
// <group id="173093" cgid="1255" spid="1" cnid="467" mgid="1002" cname="Reserve League">FBARG Reserve League-25</group>
// <hteam id="187003" >Boca Juniors II</hteam>
// <ateam id="185803" >Gimnasia LP II</ateam>
// <results>
// <status last_updated="2025-12-02T08:31:10+00:00" minute="-1">Sched</status>
// <result id="1" name="CURRENT" value="" />
// </results>
// </match>
$event = [];
$event['tx_id'] = (int) $row['id'];
$event['provider_id'] = (int) Nuh::$options['provider_id'];
$event['starttime'] = Carbon::createFromDate((string) $row->time)->toDateTimeString();
$group_name = (string) $row->group;
$event['group_id'] = (int) $row->group['id'];
$event['sport_id'] = (int) $row->group['spid'];
$event['country_id'] = (int) $row->group['cnid'];
$event['competition_group_id'] = (int) $row->group['cgid'];
$competition_group_name = (string) $row->group['cname'];
$home = (string) $row->hteam;
$event['home_id'] = (int) $row->hteam['id'];
$away = (string) $row->ateam;
$event['away_id'] = (int) $row->ateam['id'];
$event = [
'provider_id' => (int) Nuh::$options['provider_id'],
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
'sport_id' => (int) $row->group['spid'],
'home_id' => (int) $row->hteam['id'],
'away_id' => (int) $row->ateam['id'],
'country_id' => (int) $row->group['cnid'],
'group_id' => (int) $row->group['id'],
'competition_group_id' => (int) $row->group['cgid'],
];
Group::updateOrCreate([
'tx_id' => $event['group_id'],
'competition_group_id' => $event['competition_group_id'],
Event::updateOrCreate(['id' => (int) $row['id']], $event);
$group = [
'competition_group_id' => (string) $row->group['cgid'],
'sport_id' => (int) $row->group['spid'],
'country_id' => (int) $row->group['cnid'],
'name' => (string) $row->group,
];
Group::updateOrCreate(['id' => (int) $row->group['id']], $group);
$compgroup = [
'sport_id' => $event['sport_id'],
'country_id' => $event['country_id'],
], [
'name' => $group_name,
]);
'name' => (string) $row->group['cname'],
];
CompetitionGroup::updateOrCreate([
'tx_id' => $event['competition_group_id'],
'sport_id' => $event['sport_id'],
'country_id' => $event['country_id'],
], [
'name' => $competition_group_name,
]);
CompetitionGroup::updateOrCreate(['id' => (int) $row->group['cgid']], $compgroup);
Element::firstOrCreate([
'tx_id' => $event['home_id'],
'name' => $home,
'sport_id' => $event['sport_id'],
]);
$element = [
'name' => (string) $row->hteam,
'sport_id' => (int) $row->group['spid'],
];
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
Element::firstOrCreate([
'tx_id' => $event['away_id'],
'name' => $away,
'sport_id' => $event['sport_id'],
]);
Event::updateOrCreate($event, ['starttime' => $event['starttime']]);
$element = [
'name' => (string) $row->ateam,
'sport_id' => (int) $row->group['spid'],
];
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
$count++;
}
+42 -59
View File
@@ -13,7 +13,6 @@ use App\Console\Commands\Xml;
use App\Models\CompetitionGroup;
use App\Models\Element;
use App\Models\Event;
use App\Models\EventBookmaker;
use App\Models\Group;
use App\Utilities\Notice;
use Carbon\Carbon;
@@ -113,17 +112,17 @@ class Odds
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');
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} elseif (Nuh::$options['w']) {
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('tx_id');
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} else {
$_calls[] = $url.'&last='.Nuh::$options['lastcall'];
$_calls[] = $url."&ot=$markets&last=".Nuh::$options['lastcall'];
}
/*************************************************
@@ -140,63 +139,61 @@ class Odds
foreach ($data as $row) {
$event = [];
$event['tx_id'] = (int) $row['id'];
$event['starttime'] = Carbon::createFromDate((string) $row->time)->toDateTimeString();
$group_name = (string) $row->group;
$event['group_id'] = (int) $row->group['id'];
$event['sport_id'] = (int) $row->group['spid'];
$event['country_id'] = (int) $row->group['cnid'];
$event['competition_group_id'] = (int) $row->group['cgid'];
$competition_group_name = (string) $row->group['cname'];
$home = (string) $row->hteam;
$event['home_id'] = (int) $row->hteam['id'];
$away = (string) $row->ateam;
$event['away_id'] = (int) $row->ateam['id'];
$event = [
'provider_id' => (int) Nuh::$options['provider_id'],
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
'sport_id' => (int) $row->group['spid'],
'home_id' => (int) $row->hteam['id'],
'away_id' => (int) $row->ateam['id'],
'country_id' => (int) $row->group['cnid'],
'group_id' => (int) $row->group['id'],
'competition_group_id' => (int) $row->group['cgid'],
];
Group::updateOrCreate([
'tx_id' => $event['group_id'],
'competition_group_id' => $event['competition_group_id'],
Event::firstOrCreate(['id' => (int) $row['id']], $event);
$group = [
'competition_group_id' => (string) $row->group['cgid'],
'sport_id' => (int) $row->group['spid'],
'country_id' => (int) $row->group['cnid'],
'name' => (string) $row->group,
];
Group::updateOrCreate(['id' => (int) $row->group['id']], $group);
$compgroup = [
'sport_id' => $event['sport_id'],
'country_id' => $event['country_id'],
], [
'name' => $group_name,
]);
'name' => (string) $row->group['cname'],
];
CompetitionGroup::updateOrCreate([
'tx_id' => $event['competition_group_id'],
'sport_id' => $event['sport_id'],
'country_id' => $event['country_id'],
], [
'name' => $competition_group_name,
]);
CompetitionGroup::updateOrCreate(['id' => (int) $row->group['cgid']], $compgroup);
Element::firstOrCreate([
'tx_id' => $event['home_id'],
'name' => $home,
'sport_id' => $event['sport_id'],
]);
$element = [
'name' => (string) $row->hteam,
'sport_id' => (int) $row->group['spid'],
];
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
Element::firstOrCreate([
'tx_id' => $event['away_id'],
'name' => $away,
'sport_id' => $event['sport_id'],
]);
Nuh::$_event = Event::firstOrCreate($event, ['starttime' => $event['starttime']]);
$element = [
'name' => (string) $row->ateam,
'sport_id' => (int) $row->group['spid'],
];
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
$counter++;
foreach ($row->bookmaker as $book) {
Nuh::$bookmaker_id = (int) $book['bid'];
Nuh::$id = (int) $row['id'];
Nuh::$bookmaker_id = (int) $book['bid'];
$odds = [];
$odds['sport_id'] = (int) $event['sport_id'];
Nuh::$_event_bookmaker = [];
$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) {
@@ -244,20 +241,6 @@ class Odds
break;
}
}
foreach (Nuh::$_event_bookmaker as $value) {
EventBookmaker::updateOrCreate([
'event_id' => Nuh::$_event->id,
'bookmaker_id' => Nuh::$bookmaker_id,
'bookmaker_id' => Nuh::$bookmaker_id,
], [
'bmoid' => $value['bmoid'],
'provider_id' => Nuh::$options['provider_id'],
'bkm_starttime' => Carbon::createFromDate($value['starttime'])->toDateTimeString(),
'last_check_at' => Carbon::now()->toDateTimeString(),
]);
}
}
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _3Way
{
@@ -18,33 +17,17 @@ class _3Way
Notice::note('1X2 '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['h3w'] = (float) $value->o1;
$update_array['d3w'] = (float) $value->o2;
$update_array['a3w'] = (float) $value->o3;
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$bkm_starttime = (string) $value['starting_time'];
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
$odds['starting_time'] = (string) $value['starting_time'];
}
Nuh::$_event_bookmaker[] =
[
'bmoid' => $odds['bmoid'],
'starttime' => $bkm_starttime,
];
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
Odds3way::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\OddsDc;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _Dc
{
@@ -18,26 +17,16 @@ class _Dc
Notice::note('Double Chance '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['dc1x'] = (float) $value->o1;
$update_array['dc12'] = (float) $value->o2;
$update_array['dc2x'] = (float) $value->o3;
$odds['dc1x'] = (float) $value->o1;
$odds['dc12'] = (float) $value->o2;
$odds['dc2x'] = (float) $value->o3;
}
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dc2x']], 1);
OddsDc::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\OddsDnb;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _Dnb
{
@@ -18,25 +17,15 @@ class _Dnb
Notice::note('Draw No Bet '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['dnb1'] = (float) $value->o1;
$update_array['dnb2'] = (float) $value->o3;
$odds['dnb1'] = (float) $value->o1;
$odds['dnb2'] = (float) $value->o3;
}
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['dnb1'], $odds['dnb2']], 1);
OddsDnb::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\OddsGgng;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _Ggng
{
@@ -18,25 +17,15 @@ class _Ggng
Notice::note('Goal No Goal '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['gg'] = (float) $value->o1;
$update_array['ng'] = (float) $value->o3;
$odds['gg'] = (float) $value->o1;
$odds['ng'] = (float) $value->o3;
}
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
OddsGgng::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _Totals
{
@@ -18,34 +17,23 @@ class _Totals
Notice::note('Totals '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['over'] = (float) $value->o1;
$update_array['under'] = (float) $value->o2;
$update_array['total'] = (float) $value->o3;
$odds['over'] = (float) $value->o1;
$odds['under'] = (float) $value->o2;
$odds['total'] = (float) $value->o3;
}
if ($odds['sport_id'] == 1) {
if ((float) $update_array['total'] != 2.5) {
if ((float) $odds['total'] != 2.5) {
return;
}
}
$update_array['margin'] = (float) Margin::calculate([$update_array['over'], $update_array['under']], 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
OddsTotal::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}
@@ -6,7 +6,6 @@ use App\Console\Commands\Nuh;
use App\Models\OddsQualify;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _Tq
{
@@ -18,25 +17,15 @@ class _Tq
Notice::note('To Qualify '.Nuh::$bookmaker_id, 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['hta'] = (float) $value->o1;
$update_array['atq'] = (float) $value->o3;
$odds['htq'] = (float) $value->o1;
$odds['atq'] = (float) $value->o3;
}
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$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'];
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
OddsQualify::updateOrCreate([
'event_id' => Nuh::$_event->id,
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $update_array);
], $odds);
}
}