grapper betsapi fixtures
This commit is contained in:
1 parent
cec5a5e2f7
commit
e90a6c71f6
18 files changed
+3335
-3054
No files matched your search
@@ -4,6 +4,10 @@ namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mapper\LoadElements;
|
||||
use App\Mapper\LoadGroups;
|
||||
use App\Mapper\StoreElement;
|
||||
use App\Mapper\StoreGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Odds3way;
|
||||
@@ -15,6 +19,12 @@ class Willhill
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$sport_id = 1;
|
||||
|
||||
$elements = LoadElements::load(Nuh::$options['provider_id']);
|
||||
|
||||
$groups = LoadGroups::load(Nuh::$options['provider_id']);
|
||||
|
||||
/**
|
||||
* williamhill
|
||||
*/
|
||||
@@ -23,6 +33,7 @@ class Willhill
|
||||
$res = Odds3way::join('events', 'odds_3ways.event_id', 'events.id')
|
||||
->where('odds_3ways.bookmaker_id', $bookmaker_id)
|
||||
->where('events.betsapi_id', 0)
|
||||
->where('events.sport_id', $sport_id)
|
||||
->where('odds_3ways.bmoid', '>', 0)->pluck('odds_3ways.event_id', 'odds_3ways.bmoid');
|
||||
|
||||
foreach ($res as $willhill_id => $txodds_id) {
|
||||
@@ -40,7 +51,36 @@ class Willhill
|
||||
}
|
||||
|
||||
if ($betsapi_id) {
|
||||
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
|
||||
|
||||
$match = Event::where('id', (int) $txodds_id)->first();
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $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;
|
||||
$ele['name'] = $data['results'][0]['home']['name'];
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $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;
|
||||
$ele['name'] = $data['results'][0]['away']['name'];
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$group = [];
|
||||
$group['sport_id'] = $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;
|
||||
$group['name'] = $data['results'][0]['league']['name'];
|
||||
StoreGroup::store($groups, $group);
|
||||
|
||||
$match->betsapi_id = $betsapi_id;
|
||||
$match->bet365_id = $bet365_id;
|
||||
$match->save();
|
||||
|
||||
Mapper::where('event_id', $betsapi_id)->delete();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user