58 lines
1.9 KiB
PHP
58 lines
1.9 KiB
PHP
<?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\Utilities\Notice;
|
|
|
|
class GenerateAlarm
|
|
{
|
|
public static function run()
|
|
{
|
|
$debug = Nuh::$options['d'] ?? 0;
|
|
|
|
if ($debug) {
|
|
Notice::note('ALARM GENERATOR', 'b');
|
|
}
|
|
|
|
$clients = Client::get();
|
|
|
|
$multilines = AlarmMultilineSetting::get();
|
|
|
|
foreach ($clients as $client) {
|
|
|
|
foreach ($client->bookmaker as $client_bookmaker_id) {
|
|
|
|
$alarm_threshold = AlarmSettings::get($client_bookmaker_id);
|
|
|
|
$filter = AlarmBookmakerFilter::get($client_bookmaker_id);
|
|
|
|
$res = EventBookmaker::where('bookmaker_id', $client_bookmaker_id)->where('sport_id', Nuh::$options['sport_id'])->get();
|
|
|
|
foreach ($res as $event) {
|
|
|
|
foreach ($multilines as $multiline_id => $multiline) {
|
|
|
|
$odds = AlarmLoadOdds::get($event->event_id, $multiline['table'], $multiline['oddnames']);
|
|
|
|
$compare_odds = AlarmFilterCompare::get($odds, $filter);
|
|
|
|
$client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id);
|
|
|
|
AlarmStore::get($event->event_id, $multiline['table'], $client_bookmaker_id, $alarm_threshold[$multiline_id], $compare_odds, $client_odds);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|