wip
This commit is contained in:
1 parent
f5fc937311
commit
d81af0b02b
30 files changed
+381
-267
No files matched your search
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\ComparingBookmaker;
|
||||
|
||||
class AlarmBookmakerFilter
|
||||
{
|
||||
public static function get($client_bookmaker_id)
|
||||
public static function get($client_bookmaker_id, $sport_id)
|
||||
{
|
||||
$res = ComparingBookmaker::where('sport_id', Nuh::$options['sport_id'])
|
||||
$res = ComparingBookmaker::where('sport_id', $sport_id)
|
||||
->where('client_bookmaker_id', $client_bookmaker_id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('sorting', 'asc')
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\MultilineSetting;
|
||||
|
||||
class AlarmMultilineSetting
|
||||
{
|
||||
public static function get()
|
||||
public static function get($sport_id)
|
||||
{
|
||||
$res = MultilineSetting::where('sport_id', Nuh::$options['sport_id'])->get();
|
||||
$res = MultilineSetting::where('sport_id', $sport_id)->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\AlarmSetting;
|
||||
|
||||
class AlarmSettings
|
||||
{
|
||||
public static function get($client_bookmaker_id)
|
||||
public static function get($client_bookmaker_id, $sport_id)
|
||||
{
|
||||
$res = AlarmSetting::where('sport_id', Nuh::$options['sport_id'])
|
||||
$res = AlarmSetting::where('sport_id', $sport_id)
|
||||
->where('client_bookmaker_id', $client_bookmaker_id)
|
||||
->where('disabled', 0)
|
||||
->select('multiline_setting_id', 'level_id', 'alarm_threshold')
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\OddsTable;
|
||||
|
||||
class AlarmStore
|
||||
{
|
||||
public static function get($event_id, $table, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
|
||||
{
|
||||
$oddnames = AlarmMap::get($table);
|
||||
$res = OddsTable::where($table)->value('oddnames');
|
||||
$oddnames = explode(',', $res);
|
||||
|
||||
dd($oddnames);
|
||||
|
||||
if (! $compare_odds) {
|
||||
return;
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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\Sport;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class GenerateAlarms
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('GENERATE ALARMS', 'b');
|
||||
}
|
||||
|
||||
$clients = Client::get();
|
||||
|
||||
$sports = Sport::where('is_active', 1)->pluck('id');
|
||||
|
||||
foreach ($sports as $sport_id) {
|
||||
|
||||
$multilines = AlarmMultilineSetting::get($sport_id);
|
||||
|
||||
foreach ($clients as $client) {
|
||||
|
||||
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::where('bookmaker_id', $client_bookmaker_id)->where('sport_id', $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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user