comparatore bettypes wip

This commit is contained in:
salam committed 2025-12-17 16:18:29 +01:00
1 parent 26bf5359bc
commit 28032520b4
28 files changed
+446 -149

No files matched your search

+3
View File
@@ -14,6 +14,8 @@ class MultilineGenerator
MultilineClient::where('client_id', $client_id)->update(['disabled' => 1]);
$bookmaker = [0, 6, 30, 649, 117];
foreach ($record->sport as $sportid) {
$multilines = MultilineSetting::where('sport_id', $sportid)->get();
@@ -28,6 +30,7 @@ class MultilineGenerator
'sport_id' => $sportid,
'multiline_setting_id' => $multiline->id,
'sort' => $i,
'bookmaker_id' => $bookmaker[$i],
],
[
'disabled' => 0,
+1 -1
View File
@@ -6,7 +6,7 @@ use App\Models\MultilineClient;
class MultilineSlots
{
public static function addSlots(&$data)
public static function loadSlots(&$data)
{
$slots = MultilineClient::select('bookmaker_id')
->where('multiline_setting_id', auth()->user()->multiline_setting_id)
+4 -4
View File
@@ -181,9 +181,9 @@ class Odds
foreach ($row->bookmaker as $book) {
NuhBash::$bookmaker_id = (int) $book['bid'];
$odds = [];
$odds['event_id'] = NuhBash::$_event->id;
$odds['bookmaker_id'] = (int) $book['bid'];
$odds['sport_id'] = (int) $event['sport_id'];
$odds['provider_id'] = 2;
@@ -240,7 +240,7 @@ class Odds
EventBookmaker::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => $odds['bookmaker_id'],
'bookmaker_id' => NuhBash::$bookmaker_id,
], [
'bmoid' => $value['bmoid'],
'provider_id' => 2,
@@ -252,7 +252,7 @@ class Odds
}
if ($debug) {
Notice::note('END', 'g', 1);
Notice::note('END '.NuhBash::$_event->id, 'g');
}
}
}
@@ -12,11 +12,10 @@ class _3Way
{
public static function grap($odds, $offer)
{
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('1X2 '.$odds['bookmaker_id'], 'b');
Notice::note('1X2 '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -35,12 +34,17 @@ class _3Way
];
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
Odds3way::updateOrCreate($odds, $update_array);
Odds3way::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
@@ -15,7 +15,7 @@ class _Dc
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('Double Chance '.$odds['bookmaker_id'], 'b');
Notice::note('Double Chance '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -27,12 +27,17 @@ class _Dc
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsDc::updateOrCreate($odds, $update_array);
OddsDc::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
@@ -15,7 +15,7 @@ class _Dnb
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('Draw No Bet '.$odds['bookmaker_id'], 'b');
Notice::note('Draw No Bet '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -26,12 +26,17 @@ class _Dnb
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsDnb::updateOrCreate($odds, $update_array);
OddsDnb::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
@@ -15,7 +15,7 @@ class _Ggng
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('Goal No Goal '.$odds['bookmaker_id'], 'b');
Notice::note('Goal No Goal '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -26,12 +26,17 @@ class _Ggng
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsGgng::updateOrCreate($odds, $update_array);
OddsGgng::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
@@ -15,7 +15,7 @@ class _Totals
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('Totals '.$odds['bookmaker_id'], 'b');
Notice::note('Totals '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -35,12 +35,17 @@ class _Totals
$update_array['margin'] = (float) Margin::calculate([$update_array['over'], $update_array['under']], 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsTotal::updateOrCreate($odds, $update_array);
OddsTotal::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
@@ -15,7 +15,7 @@ class _Tq
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('To Qualify '.$odds['bookmaker_id'], 'b');
Notice::note('To Qualify '.NuhBash::$bookmaker_id, 'b');
}
$update_array = [];
@@ -26,12 +26,17 @@ class _Tq
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$update_array['bmoid'] = $odds['bmoid'];
$update_array['sport_id'] = $odds['sport_id'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['provider_id'] = $odds['provider_id'];
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
OddsQualify::updateOrCreate($odds, $update_array);
OddsQualify::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => NuhBash::$bookmaker_id,
], $update_array);
}
}
+2
View File
@@ -17,6 +17,8 @@ class NuhBash extends Command
public static $_event_bookmaker;
public static $bookmaker_id;
public static $AUTHTOKEN;
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
@@ -2,8 +2,7 @@
namespace App\Filament\Resources\Events\Tables;
use App\Filament\Tables\Columns\Odds3Way;
use App\Filament\Tables\Columns\OddsTotals;
use App\Filament\Tables\Columns\MultilineClient;
use Carbon\Carbon;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
@@ -27,7 +26,8 @@ class EventsTable
->size(IconSize::ExtraLarge)
->icon(fn ($record) => $record->sport->icon)
->tooltip(fn ($record) => $record->id),
TextColumn::make('txodds_id')->label('Match Id')->badge()->copyable()->searchable(),
// TextColumn::make('id'),
TextColumn::make('txodds_id')->label('Id')->badge()->copyable()->searchable(),
TextColumn::make('starttime')
->label('Start')
->alignCenter()
@@ -42,8 +42,8 @@ class EventsTable
TextColumn::make('home.name')->alignRight()->searchable(),
TextColumn::make('away.name')->searchable(),
Odds3Way::make('odds_3way.bookmaker')->label('1X2')->visible(auth()->user()->multiline_setting_id == 1),
OddsTotals::make('odds_totals.bookmaker')->label('Totals')->visible(auth()->user()->multiline_setting_id == 6),
MultilineClient::make('id')->label(fn ($record) => view('filament.tables.columns.multiline-labels')),
])
->defaultSort('starttime', 'ASC')
->deferFilters(false)
@@ -0,0 +1,113 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Models\MultilineSetting;
use Filament\Tables\Columns\Column;
use Illuminate\Support\Facades\DB;
use stdClass;
class MultilineClient extends Column
{
protected string $view = 'filament.tables.columns.multiline-client';
protected ?array $slots;
protected ?array $settings;
public function loadSlots($event_id, $bookmakers)
{
$this->settings = MultilineSetting::where('id', auth()->user()->multiline_setting_id)->select('table', 'has_3_columns')->first()->toArray();
$odds = DB::table($this->settings['table'])->where('event_id', $event_id)->get();
$this->makeSlots($odds, $bookmakers);
}
public function has3Columns(): ?int
{
return $this->settings['has_3_columns'];
}
public function getSlots(): ?array
{
return $this->slots;
}
public function makeSlots(&$odds, $bookmakers)
{
$multilines = [];
foreach ($bookmakers as $slot => $bookmaker) {
$open = true;
foreach ($odds as $item) {
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
$item->icon = $bookmaker->bookmaker->icon;
$item->table = $this->settings['table'];
switch ($this->settings['table']) {
case 'odds_2ways':
case 'odds_2ways_s1':
$item->a = $item->h3w;
$item->c = $item->a3w;
break;
case 'odds_3ways':
$item->a = $item->h3w;
$item->b = $item->d3w;
$item->c = $item->a3w;
break;
case 'odds_dc':
$item->a = $item->dc1x;
$item->b = $item->dc12;
$item->c = $item->dc2x;
break;
case 'odds_dnb':
$item->a = $item->dnb1;
$item->c = $item->dnb2;
break;
case 'odds_ggng':
$item->a = $item->gg;
$item->c = $item->ng;
break;
case 'odds_handicaps':
case 'odds_handicaps_q1':
$item->a = $item->home;
$item->b = $item->away;
$item->c = $item->handicap;
break;
case 'odds_qualify':
$item->a = $item->htq;
$item->c = $item->atq;
break;
case 'odds_totals':
case 'odds_totals_q1':
$item->a = $item->over;
$item->b = $item->under;
$item->c = $item->total;
break;
default:
// code...
break;
}
$multilines[$slot] = $item;
$open = false;
}
}
if ($open) {
$item = new stdClass;
$item->bookmaker_id = $bookmaker->bookmaker_id;
$item->icon = $bookmaker->bookmaker->icon;
$item->a = 0;
$item->b = 0;
$item->c = 0;
$item->marging = 0;
$multilines[$slot] = $item;
}
}
$this->slots = $multilines;
}
}
-23
View File
@@ -1,23 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Actions\MultilineSlots;
use Filament\Tables\Columns\Column;
class Odds3Way extends Column
{
protected string $view = 'filament.tables.columns.odds3-way';
protected ?array $slots = [];
public function loadSlots(&$data)
{
$this->slots = MultilineSlots::addSlots($data);
}
public function getSlots(): ?array
{
return $this->slots;
}
}
@@ -1,23 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Actions\MultilineSlots;
use Filament\Tables\Columns\Column;
class OddsTotals extends Column
{
protected string $view = 'filament.tables.columns.odds-totals';
protected ?array $slots = [];
public function loadSlots(&$data)
{
$this->slots = MultilineSlots::addSlots($data);
}
public function getSlots(): ?array
{
return $this->slots;
}
}
+2 -7
View File
@@ -50,13 +50,8 @@ class Event extends Model
return $this->hasOne(Element::class, 'txodds_id', 'away_id');
}
public function odds_3way()
public function multiline_client()
{
return $this->hasMany(Odds3way::class, 'event_id', 'id')->with('bookmaker');
}
public function odds_totals()
{
return $this->hasMany(OddsTotal::class, 'event_id', 'id')->with('bookmaker');
return $this->hasMany(MultilineClient::class, 'sport_id', 'sport_id')->with('bookmaker')->where('multiline_setting_id', auth()->user()->multiline_setting_id)->orderBy('sort');
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ class OddsTotal extends Model
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);
return $this->belongsTo(Bookmaker::class, 'bookmaker_id', 'txid');
}
public function event()
+2 -1
View File
@@ -10,7 +10,8 @@ class Margin
return false;
}
$r = 0;
foreach ($arr as $key => $value) {
foreach ($arr as $value) {
$value = $value < 1 ? 1 : $value;
$r += 100 / $value;
}