wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmBookmakerFilter;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmFilterClient;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmFilterCompare;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmLoadOdds;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmMultilineSetting;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmSettings;
|
||||
use App\Console\Commands\Services\Tasks\Alarm\AlarmStore;
|
||||
use App\Models\Client;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\OddsTable;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class GenerateAlarms
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('GENERATE ALARMS', 'b');
|
||||
}
|
||||
|
||||
$oddnames = OddsTable::oddnames();
|
||||
|
||||
$clients = Client::get();
|
||||
|
||||
foreach ($clients as $client) {
|
||||
if ($debug) {
|
||||
Notice::note($client->name, 'b');
|
||||
}
|
||||
|
||||
foreach ($client->sport as $sport_id) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Sport: ' . $sport_id, 'b');
|
||||
}
|
||||
|
||||
$multilines = AlarmMultilineSetting::get($sport_id);
|
||||
|
||||
foreach ($client->bookmaker as $client_bookmaker_id) {
|
||||
|
||||
$alarm_threshold = AlarmSettings::get($client_bookmaker_id, $sport_id);
|
||||
|
||||
$filter = AlarmBookmakerFilter::get($client_bookmaker_id, $sport_id);
|
||||
|
||||
$res = EventBookmaker::with('event')->where('bookmaker_id', $client_bookmaker_id)->where('sport_id', $sport_id)->get();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Event: ' . \count($res), 'b');
|
||||
}
|
||||
// $res = EventBookmaker::where('event_id', 14597944)->where('bookmaker_id', $client_bookmaker_id)->where('sport_id', $sport_id)->get();
|
||||
|
||||
foreach ($res as $event) {
|
||||
|
||||
if ($event->event->starttime > now()) {
|
||||
|
||||
foreach ($multilines as $multiline_id => $multiline) {
|
||||
|
||||
$table = $multiline['table'];
|
||||
|
||||
$odds = AlarmLoadOdds::get($event->event_id, $table, $oddnames[$table]);
|
||||
|
||||
// check if margin is > 1
|
||||
$compare_odds = AlarmFilterCompare::get($odds, $filter);
|
||||
|
||||
// check if client has odds
|
||||
$client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id);
|
||||
|
||||
if (isset($oddnames[$table]) && isset($alarm_threshold[$multiline_id])) {
|
||||
AlarmStore::get($table, $event->event_id, $oddnames[$table], $client_bookmaker_id, $alarm_threshold[$multiline_id], $compare_odds, $client_odds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user