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

No files matched your search

+10 -11
View File
@@ -17,12 +17,10 @@ class Bwin
$sportmap = Sport::map('bwin'); $sportmap = Sport::map('bwin');
$sportmap = [4]; foreach ($sportmap as $bwin_sport_id) {
$total = 1;
foreach ($sportmap as $sport_id => $bwin_sport_id) {
$page = 1; $page = 1;
$total = 10;
/** /**
* BWIN ODDS & BETRADAR ID (per page) * BWIN ODDS & BETRADAR ID (per page)
@@ -32,24 +30,25 @@ class Bwin
while ($page <= $total) { while ($page <= $total) {
if ($debug) {
Notice::note("Page: $page \Sport: $bwin_sport_id", 'b');
}
$url = str_replace('###page###', $page, $base_url); $url = str_replace('###page###', $page, $base_url);
$data = Curl::load($url); $data = Curl::load($url);
if (! isset($data['pager'])) { if (isset($data['pager'])) {
return;
}
$total = round($data['pager']['total'] / $data['pager']['per_page']); $total = round($data['pager']['total'] / $data['pager']['per_page']);
if ($debug) {
Notice::note("Page: $page \nTotal: $total");
} }
$page++; $page++;
if (isset($data['results'])) { if (isset($data['results'])) {
foreach ($data['results'] as $event) { 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; $betsapi_id = $event['our_event_id'] ?? 0;
@@ -32,7 +32,7 @@ class Fixtures
$country_map = Country::pluck('id', 'iso2'); $country_map = Country::pluck('id', 'iso2');
$sportmap = Sport::map('bapi', 0, [1]); $sportmap = Sport::map('bapi', 0, [1, 2, 3, 5]);
$now = Carbon::now(); $now = Carbon::now();
@@ -8,6 +8,7 @@ use App\Console\Commands\Grapper\Fixtures\StoreGroup;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Models\Event; use App\Models\Event;
use App\Models\Mapper; use App\Models\Mapper;
use App\Models\Odds2way;
use App\Models\Odds3way; use App\Models\Odds3way;
use App\Utilities\Notice; use App\Utilities\Notice;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -18,27 +19,38 @@ class Willhill
{ {
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$sport_id = 1; $sports = [1, 2, 3, 5];
/** /**
* williamhill * williamhill
*/ */
$bookmaker_id = 42; $bookmaker_id = 42;
$collection = [];
$res = Event::with('odds_3ways') $res = Odds3way::with('event')->where('bookmaker_id', $bookmaker_id)->get();
->where('betsapi_id', 0) foreach ($res as $value) {
->where('sport_id', $sport_id) if ($value->event->starttime > Carbon::now() && ! $value->event->betsapi_id) {
->where('starttime', '>', Carbon::now()) $collection[] = [
->pluck('id'); '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) foreach ($collection as $event) {
->whereIn('event_id', $res)
->where('bmoid', '!=', 0)
->pluck('event_id', 'bmoid');
foreach ($events as $willhill_id => $txodds_id) { $url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$event['willhill_id'];
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id;
$data = Curl::load($url); $data = Curl::load($url);
@@ -47,17 +59,17 @@ class Willhill
$bet365_id = $data['results'][0]['bet365_id'] ?? 0; $bet365_id = $data['results'][0]['bet365_id'] ?? 0;
if ($debug) { 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 ($betsapi_id) {
if (isset($data['results'][0]['home'])) { 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 = [];
$ele['sport_id'] = $sport_id; $ele['sport_id'] = $event['sport_id'];
$ele['provider_id'] = Nuh::$options['provider_id']; $ele['provider_id'] = Nuh::$options['provider_id'];
$ele['element_id'] = $match->home_id ?? 0; $ele['element_id'] = $match->home_id ?? 0;
$ele['provider_element_id'] = $data['results'][0]['home']['id'] ?? 0; $ele['provider_element_id'] = $data['results'][0]['home']['id'] ?? 0;
@@ -65,7 +77,7 @@ class Willhill
StoreElement::store($elements, $ele); StoreElement::store($elements, $ele);
$ele = []; $ele = [];
$ele['sport_id'] = $sport_id; $ele['sport_id'] = $event['sport_id'];
$ele['provider_id'] = Nuh::$options['provider_id']; $ele['provider_id'] = Nuh::$options['provider_id'];
$ele['element_id'] = $match->away_id ?? 0; $ele['element_id'] = $match->away_id ?? 0;
$ele['provider_element_id'] = $data['results'][0]['away']['id'] ?? 0; $ele['provider_element_id'] = $data['results'][0]['away']['id'] ?? 0;
@@ -73,7 +85,7 @@ class Willhill
StoreElement::store($elements, $ele); StoreElement::store($elements, $ele);
$group = []; $group = [];
$group['sport_id'] = $sport_id; $ele['sport_id'] = $event['sport_id'];
$group['provider_id'] = Nuh::$options['provider_id']; $group['provider_id'] = Nuh::$options['provider_id'];
$group['competition_group_id'] = $match->competition_group_id; $group['competition_group_id'] = $match->competition_group_id;
$group['provider_group_id'] = $data['results'][0]['league']['id'] ?? 0; $group['provider_group_id'] = $data['results'][0]['league']['id'] ?? 0;
@@ -17,6 +17,7 @@ class BookmakersTable
->striped() ->striped()
->recordAction(null) ->recordAction(null)
->columns([ ->columns([
TextColumn::make('id')->searchable(),
TextColumn::make('name') TextColumn::make('name')
->searchable(), ->searchable(),
BookmakerIcon::make('icon')->label('Icon'), 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\ColumnTotalHt;
use App\Filament\Tables\Columns\ColumnTotalQ1; use App\Filament\Tables\Columns\ColumnTotalQ1;
use App\Filament\Tables\Columns\ColumnTq; use App\Filament\Tables\Columns\ColumnTq;
use App\Filament\Tables\Columns\EventColumn;
use App\Filament\Tables\Columns\MatchIds; use App\Filament\Tables\Columns\MatchIds;
use App\Models\BettypeUser; use App\Models\BettypeUser;
use App\Models\CompetitionGroup; use App\Models\CompetitionGroup;
use App\Models\Country; use App\Models\Country;
use App\Models\Event; use App\Models\Event;
use App\Models\EventUserStar; use App\Models\EventUserStar;
use App\Models\Group;
use App\Models\MultilineClient; use App\Models\MultilineClient;
use App\Models\Sport;
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker; use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
use Filament\Actions\Action; use Filament\Actions\Action;
use Filament\Actions\ActionGroup; use Filament\Actions\ActionGroup;
@@ -30,6 +33,7 @@ use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction; use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction; use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Icon;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
use Filament\Support\Enums\FontWeight; use Filament\Support\Enums\FontWeight;
use Filament\Support\Enums\VerticalAlignment; use Filament\Support\Enums\VerticalAlignment;
@@ -113,19 +117,11 @@ class EventsTable
TextColumn::make('country.name') TextColumn::make('country.name')
->wrap() ->wrap()
->hidden(fn () => auth()->user()->sport_id == 5)
->color('gray') ->color('gray')
->label('Event') ->icon(fn ($record) => $record->country?->icon),
->icon(fn ($record) => $record->country->icon)
->description(fn ($record) => $record->competition_group->name),
TextColumn::make('home.name') EventColumn::make('event'),
->wrap()
->searchable()
->alignRight(),
TextColumn::make('away.name')
->wrap()
->searchable(),
ColumnMl::make('odds_2ways')->bookmakers(self::$multiline_gettype['odds_2ways'] ?? []) ColumnMl::make('odds_2ways')->bookmakers(self::$multiline_gettype['odds_2ways'] ?? [])
->visible(fn () => in_array('odds_2ways', self::$bettype_settings)) ->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
@@ -218,14 +214,34 @@ class EventsTable
->width(190) ->width(190)
->label('To Qualify'), ->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') ->defaultSort('starttime', 'ASC')
->extremePaginationLinks() ->extremePaginationLinks()
->filters([ ->filters([
Filter::make('events') Filter::make('events')
->columns(9)->columnSpan(9)
->schema([ ->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') Select::make(name: 'country_id')
->columnSpan(2) ->columnSpan(2)
->hidden(fn () => auth()->user()->sport_id == 5)
->placeholder('Country') ->placeholder('Country')
->hiddenLabel() ->hiddenLabel()
->label('') ->label('')
@@ -243,6 +259,7 @@ class EventsTable
$set('competition_group_id', null); $set('competition_group_id', null);
}), }),
Select::make('competition_group_id') Select::make('competition_group_id')
->hidden(fn () => auth()->user()->sport_id == 5)
->columnSpan(2) ->columnSpan(2)
->placeholder('League') ->placeholder('League')
->hiddenLabel() ->hiddenLabel()
@@ -264,8 +281,31 @@ class EventsTable
return $arr; return $arr;
}) })
->live(), ->live(),
DateRangePicker::make('starttime_period') Select::make('group_id')
->columnSpan(2) ->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') ->displayFormat('d M Y')
->minDate(now()) ->minDate(now())
->hiddenLabel() ->hiddenLabel()
@@ -281,6 +321,9 @@ class EventsTable
->when( ->when(
$data['country_id'], $data['country_id'],
fn (Builder $query, $country_id) => $query->where('country_id', $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( )->when(
$data['competition_group_id'], $data['competition_group_id'],
fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $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) { if ($data['competition_group_id'] ?? null) {
$competition_groups = CompetitionGroup::whereIn('id', $data['competition_group_id'])->pluck('name')->toArray(); $competition_groups = CompetitionGroup::whereIn('id', $data['competition_group_id'])->pluck('name')->toArray();
if (count($competition_groups) > 1) { if (count($competition_groups) > 1) {
@@ -347,9 +399,8 @@ class EventsTable
} }
return $indicators; return $indicators;
}) }),
->columns(2)->columnSpan(2), ], layout: FiltersLayout::AboveContent)
], layout: FiltersLayout::Modal)
->deferFilters(false) ->deferFilters(false)
->persistFiltersInSession() ->persistFiltersInSession()
->recordActions([ ->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": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^8.3" "php": "^8.3"
}, },
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.9.0"
} }
+3 -3
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`) $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 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'), (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, 1, 0, 10, '2025-12-01 05:41:02', '2026-01-16 09:33:49'), (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'), (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'), (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'), (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'), (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'), (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'), (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'), (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'), (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'), (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'),
@@ -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>