This commit is contained in:
salam committed 2026-01-19 08:48:39 +01:00
1 parent 4184acdb8a
commit 8f1aeafe46
9 files changed
+135 -54

No files matched your search

+11 -12
View File
@@ -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;
@@ -17,6 +17,7 @@ class BookmakersTable
->striped()
->recordAction(null)
->columns([
TextColumn::make('id')->searchable(),
TextColumn::make('name')
->searchable(),
BookmakerIcon::make('icon')->label('Icon'),
@@ -15,13 +15,16 @@ use App\Filament\Tables\Columns\ColumnTotal;
use App\Filament\Tables\Columns\ColumnTotalHt;
use App\Filament\Tables\Columns\ColumnTotalQ1;
use App\Filament\Tables\Columns\ColumnTq;
use App\Filament\Tables\Columns\EventColumn;
use App\Filament\Tables\Columns\MatchIds;
use App\Models\BettypeUser;
use App\Models\CompetitionGroup;
use App\Models\Country;
use App\Models\Event;
use App\Models\EventUserStar;
use App\Models\Group;
use App\Models\MultilineClient;
use App\Models\Sport;
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
@@ -30,6 +33,7 @@ use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Icon;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Support\Enums\FontWeight;
use Filament\Support\Enums\VerticalAlignment;
@@ -113,19 +117,11 @@ class EventsTable
TextColumn::make('country.name')
->wrap()
->hidden(fn () => auth()->user()->sport_id == 5)
->color('gray')
->label('Event')
->icon(fn ($record) => $record->country->icon)
->description(fn ($record) => $record->competition_group->name),
->icon(fn ($record) => $record->country?->icon),
TextColumn::make('home.name')
->wrap()
->searchable()
->alignRight(),
TextColumn::make('away.name')
->wrap()
->searchable(),
EventColumn::make('event'),
ColumnMl::make('odds_2ways')->bookmakers(self::$multiline_gettype['odds_2ways'] ?? [])
->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
@@ -218,14 +214,34 @@ class EventsTable
->width(190)
->label('To Qualify'),
])->searchable(['id', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'magnig_id', 'magken_id', 'lognig_id', 'logcol_id'])
])->searchable(['id', 'home.name', 'away.name', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'magnig_id', 'magken_id', 'lognig_id', 'logcol_id'])
->defaultSort('starttime', 'ASC')
->extremePaginationLinks()
->filters([
Filter::make('events')
->columns(9)->columnSpan(9)
->schema([
Select::make(name: 'sport_id')
->beforeContent(Icon::make(fn () => auth()->user()->sport->icon))
->placeholder('Sport')
->hiddenLabel()
->label('')
->multiple()
->searchable()
->preload()
->options(function () {
return Sport::query()->where('is_active', 1)->pluck('name', 'id');
})
->live()
->reactive()
->afterStateUpdated(function (callable $set) {
$set('country_id', null);
$set('competition_group_id', null);
$set('group_id', null);
}),
Select::make(name: 'country_id')
->columnSpan(2)
->hidden(fn () => auth()->user()->sport_id == 5)
->placeholder('Country')
->hiddenLabel()
->label('')
@@ -243,6 +259,7 @@ class EventsTable
$set('competition_group_id', null);
}),
Select::make('competition_group_id')
->hidden(fn () => auth()->user()->sport_id == 5)
->columnSpan(2)
->placeholder('League')
->hiddenLabel()
@@ -264,8 +281,31 @@ class EventsTable
return $arr;
})
->live(),
DateRangePicker::make('starttime_period')
Select::make('group_id')
->columnSpan(2)
->visible(fn () => auth()->user()->sport_id == 5)
->placeholder('Tournament')
->hiddenLabel()
->label('')
->multiple()
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::with('country')->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
} else {
$res = Event::with('country')->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
}
$arr = [];
foreach ($res as $val) {
$arr[$val->group_id] = $val->country?->name.' '.$val->group->name;
}
asort($arr);
return $arr;
})
->live(),
DateRangePicker::make('starttime_period')
->columnSpan(4)
->displayFormat('d M Y')
->minDate(now())
->hiddenLabel()
@@ -281,6 +321,9 @@ class EventsTable
->when(
$data['country_id'],
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
)->when(
$data['group_id'],
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
)->when(
$data['competition_group_id'],
fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $competition_group_id)
@@ -319,6 +362,15 @@ class EventsTable
}
}
if ($data['group_id'] ?? null) {
$group_ids = Group::whereIn('id', $data['group_id'])->pluck('name')->toArray();
if (count($group_ids) > 1) {
$indicators[] = Indicator::make('Tournament: '.implode(', ', $group_ids))->removeField('group_id');
} else {
$indicators[] = Indicator::make('Tournaments: '.$group_ids[0])->removeField('group_id');
}
}
if ($data['competition_group_id'] ?? null) {
$competition_groups = CompetitionGroup::whereIn('id', $data['competition_group_id'])->pluck('name')->toArray();
if (count($competition_groups) > 1) {
@@ -347,9 +399,8 @@ class EventsTable
}
return $indicators;
})
->columns(2)->columnSpan(2),
], layout: FiltersLayout::Modal)
}),
], layout: FiltersLayout::AboveContent)
->deferFilters(false)
->persistFiltersInSession()
->recordActions([
@@ -0,0 +1,10 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class EventColumn extends Column
{
protected string $view = 'filament.tables.columns.event-column';
}
Generated
+3 -3
View File
@@ -12814,12 +12814,12 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"platform-dev": {},
"plugin-api-version": "2.9.0"
}
+4 -4
View File
@@ -14,8 +14,8 @@ class SupervisorSeeder extends Seeder
*/
$sql = "INSERT INTO `supervisors` (`id`, `name`, `provider_id`, `sport_id`, `txodds_market_id`, `sleep`, `limit`, `runtime`, `commandline_options`, `maxsconds`, `lastcall`, `use_lastcall`, `is_supervisor`, `is_active`, `days_from`, `days_to`, `created_at`, `updated_at`)
VALUES
(1, 'Fixtures', 1, NULL, NULL, 10, 0, '0.125', NULL, 1800, 0, 0, 0, 0, 0, 0, '2025-08-27 07:39:55', '2026-01-16 09:30:48'),
(2, 'Odds', 1, 1, NULL, 10, 0, '2.997', NULL, 30, 0, 0, 1, 1, 0, 10, '2025-12-01 05:41:02', '2026-01-16 09:33:49'),
(1, 'Fixtures', 1, NULL, NULL, 10, 0, '0', NULL, 1800, 0, 0, 0, 0, 0, 30, '2025-08-27 07:39:55', '2026-01-19 04:18:53'),
(2, 'Odds', 1, 1, NULL, 10, 0, '2.997', NULL, 30, 0, 0, 1, 0, 0, 10, '2025-12-01 05:41:02', '2026-01-19 04:17:02'),
(3, 'Fixtures', 2, 0, NULL, 15, 0, '0.266', NULL, 1800, 0, 0, 0, 0, 0, 0, '2025-12-19 11:42:35', '2026-01-16 09:34:05'),
(4, 'Willhill', 2, 0, NULL, 15, 0, '0.842', NULL, 1800, 0, 0, 0, 0, 0, 0, '2025-12-19 11:48:05', '2026-01-16 09:34:57'),
(5, 'Bwin', 2, 0, NULL, 15, 0, '0.278', NULL, 1800, 0, 0, 0, 0, 0, 0, '2025-12-22 06:41:18', '2026-01-16 09:35:14'),
@@ -36,7 +36,7 @@ class SupervisorSeeder extends Seeder
(20, 'Odds', 1, 3, NULL, 15, 0, NULL, NULL, 30, 0, 0, 1, 0, 0, 10, '2026-01-08 17:56:50', '2026-01-14 15:52:42'),
(21, 'Odds', 1, 2, NULL, 15, 0, NULL, NULL, 30, 0, 0, 1, 0, 0, 10, '2026-01-08 17:57:14', '2026-01-14 15:52:43'),
(22, 'Odds', 1, 5, NULL, 15, 0, NULL, NULL, 30, 0, 0, 1, 0, 0, 10, '2026-01-08 17:57:24', '2026-01-14 15:52:44'),
(23, 'DB Mapper', 7, NULL, NULL, 15, 0, '0.006', NULL, 1800, 0, 0, 0, 1, NULL, NULL, '2026-01-13 05:55:30', '2026-01-13 06:41:35'),
(23, 'DB Mapper', 7, NULL, NULL, 15, 0, '0.006', NULL, 1800, 0, 0, 0, 0, 0, 0, '2026-01-13 05:55:30', '2026-01-19 04:17:21'),
(24, '', 8, 1, 0, 30, 0, '0.067', NULL, 30, 1768405759, 0, 1, 0, 10, 10, '2026-01-14 15:42:40', '2026-01-14 17:22:36'),
(25, '', 8, 1, 4, 30, 0, NULL, NULL, 30, 0, 0, 1, 0, 10, 10, '2026-01-14 16:56:25', '2026-01-14 17:20:08'),
(26, '', 8, 1, 65536, 30, 0, NULL, NULL, 30, 0, 0, 1, 0, 10, 10, '2026-01-14 16:56:28', '2026-01-14 17:20:08'),
@@ -66,7 +66,7 @@ class SupervisorSeeder extends Seeder
(50, '', 8, 5, 131073, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-14 17:41:16', '2026-01-14 17:41:25'),
(51, '', 9, 1, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14'),
(52, '', 10, 0, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14');
";
";
DB::unprepared($sql);
}
}
@@ -0,0 +1,8 @@
<div {{ $getExtraAttributeBag() }} class="flex flex-col gap-2 w-full">
<div class="flex flex-1 gap-1 font-bold">
<div>{{ $record->home->name }}</div>
<div>-</div>
<div>{{ $record->away->name }}</div>
</div>
<div>{{ $record->group->name }}</div>
</div>