wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Bookmaker;
|
||||
|
||||
class CompareOptions
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
|
||||
$map = Bookmaker::map();
|
||||
$favorits = [];
|
||||
$margins = [];
|
||||
$x = [];
|
||||
switch (auth()->user()->sport_id) {
|
||||
case 1:
|
||||
case 2:
|
||||
$table = 'odds_3ways';
|
||||
break;
|
||||
case 3:
|
||||
$table = 'odds_points';
|
||||
break;
|
||||
case 5:
|
||||
$table = 'odds_2ways';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$options = [];
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
if (isset($map[$bookmaker_id])) {
|
||||
$option = 'Favorit-lte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$favorits[$option] = 'Favorit ≤ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
}
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
if (isset($map[$bookmaker_id])) {
|
||||
$option = 'Favorit-gte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$favorits[$option] = 'Favorit ≥ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
}
|
||||
$options['Favorits'] = $favorits;
|
||||
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
if (isset($map[$bookmaker_id])) {
|
||||
$option = 'Margin-gte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$margins[$option] = 'Margin ≥ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
}
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
if (isset($map[$bookmaker_id])) {
|
||||
$option = 'Margin-lt-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$margins[$option] = 'Margin < '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
}
|
||||
$options['Margins'] = $margins;
|
||||
|
||||
if (auth()->user()->sport_id == 1) {
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
if (isset($map[$bookmaker_id])) {
|
||||
$option = 'X-lt-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$x[$option] = 'X < '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
}
|
||||
$options['X'] = $x;
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\BettypeUser;
|
||||
|
||||
class LoadBettypeSettings
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$res = BettypeUser::with('multiline_setting')
|
||||
->where('user_id', auth()->user()->id)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('sorting')
|
||||
->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
$arr[] = $value->multiline_setting->table;
|
||||
}
|
||||
EventsTable::$bettype_settings = $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\Event;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadClientStartimeDifference
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
|
||||
$events = Event::with('event_bookmaker')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>=', Carbon::now())
|
||||
->whereHas('event_bookmaker', function ($query) {
|
||||
$query->where('bookmaker_id', auth()->user()->bookmaker_id);
|
||||
})
|
||||
->get();
|
||||
|
||||
$event_ids = [];
|
||||
foreach ($events as $event) {
|
||||
if ($event->starttime != $event->event_bookmaker->starttime) {
|
||||
$event_ids[] = $event->id;
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\OddsTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LoadCompareDifferences
|
||||
{
|
||||
public static function load($target, $mode, $table, $compare_bookmaker_id)
|
||||
{
|
||||
$fields = OddsTable::fields();
|
||||
|
||||
// dd($target, $mode, $table, $compare_bookmaker_id);
|
||||
|
||||
// echo $table."\n";
|
||||
// dd(auth()->user()->sport_id);
|
||||
|
||||
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
|
||||
|
||||
if ($has_active_spread) {
|
||||
$clients = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
$comparing = DB::table($table)
|
||||
->where('bookmaker_id', $compare_bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
} else {
|
||||
// $clients = DB::table($table)->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, $compare_bookmaker_id])->get();
|
||||
$clients = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->get();
|
||||
$comparing = DB::table($table)
|
||||
->where('bookmaker_id', $compare_bookmaker_id)
|
||||
->get();
|
||||
}
|
||||
|
||||
$event_ids = [];
|
||||
foreach ($clients as $client) {
|
||||
|
||||
$row1 = get_object_vars($client);
|
||||
|
||||
foreach ($comparing as $compare) {
|
||||
|
||||
$row2 = get_object_vars($compare);
|
||||
|
||||
if ($row1['event_id'] == $row2['event_id']) {
|
||||
|
||||
switch ($target) {
|
||||
case 'Favorit':
|
||||
$bk = 100;
|
||||
$co = 100;
|
||||
foreach ($fields[$table] as $field) {
|
||||
if ($row1[$field] < $bk) {
|
||||
$bk = $row1[$field];
|
||||
}
|
||||
if ($row2[$field] < $co) {
|
||||
$co = $row2[$field];
|
||||
}
|
||||
}
|
||||
switch ($mode) {
|
||||
case 'lte':
|
||||
|
||||
if ($bk > 1 && $co > 1 && $bk <= $co) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
case 'gte':
|
||||
if ($bk > 1 && $co > 1 && $bk >= $co) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'Margin':
|
||||
switch ($mode) {
|
||||
case 'gte':
|
||||
if ($row1['margin'] >= $row2['margin']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
case 'lt':
|
||||
if ($row1['margin'] < $row2['margin']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'X':
|
||||
if ($row1['d3w'] < $row2['d3w']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
|
||||
class LoadMultiline
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$cb = ComparingBookmaker::where('sport_id', auth()->user()->sport_id)
|
||||
->where('client_bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->orderBy('sorting', 'desc')
|
||||
->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')
|
||||
->get();
|
||||
|
||||
$bookmakers = [];
|
||||
$filter = [];
|
||||
foreach ($cb as $value) {
|
||||
if (auth()->user()->bookmaker_id != $value->bookmaker_id) {
|
||||
$bookmakers[] = $value->bookmaker_id;
|
||||
$filter[$value->bookmaker_id] = [
|
||||
'time_lastcheck' => $value->time_lastcheck,
|
||||
'margin' => $value->margin_threshold,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$res = MultilineSetting::where('sport_id', auth()->user()->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
EventsTable::$filter[$value->table] = $filter;
|
||||
EventsTable::$bookmaker[$value->table] = $bookmakers;
|
||||
}
|
||||
|
||||
$res = MultilineClient::with('multiline_setting')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('client_bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->select('bookmaker_id', 'multiline_setting_id')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
EventsTable::$slots[$table][] = (int) $value->bookmaker_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\OddsTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LoadPartnerDifferences
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$event_ids = [];
|
||||
foreach (EventsTable::$bettype_settings as $table) {
|
||||
|
||||
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
|
||||
|
||||
if ($has_active_spread) {
|
||||
$events = DB::table($table)
|
||||
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
} else {
|
||||
$events = DB::table($table)
|
||||
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
|
||||
->get();
|
||||
}
|
||||
$res = [];
|
||||
foreach ($events as $value) {
|
||||
$value = get_object_vars($value);
|
||||
$event_id = $value['event_id'];
|
||||
foreach (['id', 'event_id', 'sport_id', 'bookmaker_id', 'provider_id', 'offer_id', 'bmoid', 'margin', 'flags', 'nuh_check', 'last_updated', 'created_at', 'updated_at'] as $fieldname) {
|
||||
unset($value[$fieldname]);
|
||||
}
|
||||
$res[$event_id][] = $value;
|
||||
}
|
||||
|
||||
foreach ($res as $event_id => $odds) {
|
||||
if (count($odds) == 2 && array_diff($odds[0], $odds[1])) {
|
||||
$event_ids[] = $event_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user