wip
This commit is contained in:
1 parent
4184acdb8a
commit
8f1aeafe46
10 files changed
+136
-55
No files matched your search
@@ -17,12 +17,10 @@ class Bwin
|
||||
|
||||
$sportmap = Sport::map('bwin');
|
||||
|
||||
$sportmap = [4];
|
||||
|
||||
$total = 1;
|
||||
foreach ($sportmap as $sport_id => $bwin_sport_id) {
|
||||
foreach ($sportmap as $bwin_sport_id) {
|
||||
|
||||
$page = 1;
|
||||
$total = 10;
|
||||
|
||||
/**
|
||||
* BWIN ODDS & BETRADAR ID (per page)
|
||||
@@ -32,24 +30,25 @@ class Bwin
|
||||
|
||||
while ($page <= $total) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Page: $page \Sport: $bwin_sport_id", 'b');
|
||||
}
|
||||
|
||||
$url = str_replace('###page###', $page, $base_url);
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! isset($data['pager'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$total = round($data['pager']['total'] / $data['pager']['per_page']);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Page: $page \nTotal: $total");
|
||||
if (isset($data['pager'])) {
|
||||
$total = round($data['pager']['total'] / $data['pager']['per_page']);
|
||||
}
|
||||
|
||||
$page++;
|
||||
|
||||
if (isset($data['results'])) {
|
||||
foreach ($data['results'] as $event) {
|
||||
if ($debug && isset($event['HomeTeam'])) {
|
||||
Notice::note($event['RegionName'].'-'.$event['SportName']."\n".$event['HomeTeam'].' - '.$event['AwayTeam']);
|
||||
}
|
||||
|
||||
$betsapi_id = $event['our_event_id'] ?? 0;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Fixtures
|
||||
|
||||
$country_map = Country::pluck('id', 'iso2');
|
||||
|
||||
$sportmap = Sport::map('bapi', 0, [1]);
|
||||
$sportmap = Sport::map('bapi', 0, [1, 2, 3, 5]);
|
||||
|
||||
$now = Carbon::now();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Console\Commands\Grapper\Fixtures\StoreGroup;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -18,27 +19,38 @@ class Willhill
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$sport_id = 1;
|
||||
$sports = [1, 2, 3, 5];
|
||||
|
||||
/**
|
||||
* williamhill
|
||||
*/
|
||||
$bookmaker_id = 42;
|
||||
$collection = [];
|
||||
|
||||
$res = Event::with('odds_3ways')
|
||||
->where('betsapi_id', 0)
|
||||
->where('sport_id', $sport_id)
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->pluck('id');
|
||||
$res = Odds3way::with('event')->where('bookmaker_id', $bookmaker_id)->get();
|
||||
foreach ($res as $value) {
|
||||
if ($value->event->starttime > Carbon::now() && ! $value->event->betsapi_id) {
|
||||
$collection[] = [
|
||||
'txodds_id' => $value->event_id,
|
||||
'willhill_id' => $value->bmoid,
|
||||
'sport_id' => $value->sport_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
$res = Odds2way::with('event')->where('bookmaker_id', $bookmaker_id)->get();
|
||||
foreach ($res as $value) {
|
||||
if ($value->event->starttime > Carbon::now() && ! $value->event->betsapi_id) {
|
||||
$collection[] = [
|
||||
'txodds_id' => $value->event_id,
|
||||
'willhill_id' => $value->bmoid,
|
||||
'sport_id' => $value->sport_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$events = Odds3way::where('bookmaker_id', $bookmaker_id)
|
||||
->whereIn('event_id', $res)
|
||||
->where('bmoid', '!=', 0)
|
||||
->pluck('event_id', 'bmoid');
|
||||
foreach ($collection as $event) {
|
||||
|
||||
foreach ($events as $willhill_id => $txodds_id) {
|
||||
|
||||
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id;
|
||||
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$event['willhill_id'];
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
@@ -47,17 +59,17 @@ class Willhill
|
||||
$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');
|
||||
Notice::note(['TXdds ID : '.$event['txodds_id'], "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", 'Willhill ID : '.$event['willhill_id']], 'b');
|
||||
}
|
||||
|
||||
if ($betsapi_id) {
|
||||
|
||||
if (isset($data['results'][0]['home'])) {
|
||||
|
||||
$match = Event::where('id', (int) $txodds_id)->first();
|
||||
$match = Event::where('id', (int) $event['txodds_id'])->first();
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $sport_id;
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = Nuh::$options['provider_id'];
|
||||
$ele['element_id'] = $match->home_id ?? 0;
|
||||
$ele['provider_element_id'] = $data['results'][0]['home']['id'] ?? 0;
|
||||
@@ -65,7 +77,7 @@ class Willhill
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $sport_id;
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = Nuh::$options['provider_id'];
|
||||
$ele['element_id'] = $match->away_id ?? 0;
|
||||
$ele['provider_element_id'] = $data['results'][0]['away']['id'] ?? 0;
|
||||
@@ -73,7 +85,7 @@ class Willhill
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$group = [];
|
||||
$group['sport_id'] = $sport_id;
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$group['provider_id'] = Nuh::$options['provider_id'];
|
||||
$group['competition_group_id'] = $match->competition_group_id;
|
||||
$group['provider_group_id'] = $data['results'][0]['league']['id'] ?? 0;
|
||||
|
||||
Reference in new issue
Block a user