bet365 halftime 1x2
This commit is contained in:
1 parent
31a0ccdf3b
commit
6e12c1d098
3 files changed
+47
-5
No files matched your search
@@ -6,6 +6,7 @@ use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\Odds3wayHt;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsDnb;
|
||||
use App\Models\OddsGgng;
|
||||
@@ -24,12 +25,16 @@ class Bet365
|
||||
|
||||
$week = Nuh::$options['w'] ?? 0;
|
||||
|
||||
$single = Nuh::$options['id'] ?? 0;
|
||||
|
||||
/**
|
||||
* Bet365
|
||||
*/
|
||||
$bookmaker_id = 126;
|
||||
|
||||
if ($today) {
|
||||
if ($single) {
|
||||
$events = Event::where('id', Nuh::$options['id'])->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
} elseif ($today) {
|
||||
$events = Event::where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDay()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
} elseif ($week) {
|
||||
$events = Event::where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
@@ -101,12 +106,13 @@ class Bet365
|
||||
* 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) {
|
||||
if ($offer['goals_over_under']['odds'][1]['name'] == '2.5') {
|
||||
OddsTotal::updateOrCreate([
|
||||
'event_id' => $event->id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
@@ -144,6 +150,27 @@ class Bet365
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], $base + $odds);
|
||||
}
|
||||
|
||||
/**
|
||||
* HALFTIME
|
||||
*/
|
||||
$offer = $data['results'][0]['half']['sp'] ?? '';
|
||||
|
||||
/**
|
||||
* 1X2 HT
|
||||
*/
|
||||
if (isset($offer['half_time_result'])) {
|
||||
$odds = [];
|
||||
$odds['h3w'] = $offer['half_time_result']['odds'][0]['odds'] ?? 1;
|
||||
$odds['d3w'] = $offer['half_time_result']['odds'][1]['odds'] ?? 1;
|
||||
$odds['a3w'] = $offer['half_time_result']['odds'][2]['odds'] ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
Odds3wayHt::updateOrCreate([
|
||||
'event_id' => $event->id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], $base + $odds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\Group;
|
||||
use App\Utilities\Notice;
|
||||
@@ -244,6 +245,8 @@ class Odds
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$sport_id = (int) $row->group['spid'];
|
||||
|
||||
$event = [
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
|
||||
@@ -275,16 +278,28 @@ class Odds
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->hteam,
|
||||
'sport_id' => (int) $row->group['spid'],
|
||||
'sport_id' => (int) $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->hteam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->ateam,
|
||||
'sport_id' => (int) $row->group['spid'],
|
||||
'sport_id' => (int) $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->ateam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
Nuh::$collector = [];
|
||||
|
||||
foreach ($row->bookmaker as $book) {
|
||||
|
||||
@@ -223,7 +223,7 @@ class EventsTable
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::query()->whereDate('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
$res = Event::query()->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user