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

+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(),
]);
}
}
}
}