wip
This commit is contained in:
1 parent
f5fc937311
commit
d81af0b02b
30 files changed
+381
-267
No files matched your search
@@ -16,6 +16,7 @@ use App\Models\Sport;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Bet365
|
||||
{
|
||||
@@ -31,7 +32,7 @@ class Bet365
|
||||
|
||||
$sportmap = Sport::map('bapi', 1, [1, 2, 3, 5]);
|
||||
|
||||
$flags = [];
|
||||
$events_collector = [];
|
||||
|
||||
/**
|
||||
* Bet365
|
||||
@@ -92,88 +93,29 @@ class Bet365
|
||||
* 1X2
|
||||
*/
|
||||
if (isset($offer['full_time_result'])) {
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($offer['full_time_result']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($offer['full_time_result']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($offer['full_time_result']['odds'][2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
$data = $offer['full_time_result']['odds'] ?? [];
|
||||
|
||||
$flags['odds_3ways'][] = $event->id;
|
||||
if ($data) {
|
||||
|
||||
$res = Odds3way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->a3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
/**
|
||||
* DC
|
||||
*/
|
||||
if (isset($offer['double_chance'])) {
|
||||
$odds = [];
|
||||
$odds['dc1x'] = number_format($offer['double_chance']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['dc12'] = number_format($offer['double_chance']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['dcx2'] = number_format($offer['double_chance']['odds'][2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$events_collector['odds_3ways'][] = $event->id;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$flags['odds_dc'][] = $event->id;
|
||||
|
||||
$res = OddsDc::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($odds);
|
||||
} else {
|
||||
$res->dc1x = $odds['dc1x'];
|
||||
$res->dc12 = $odds['dc12'];
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OU
|
||||
*/
|
||||
if (isset($offer['goals_over_under'])) {
|
||||
|
||||
$odds = [];
|
||||
$odds['over'] = number_format($offer['goals_over_under']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['under'] = number_format($offer['goals_over_under']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
if ($base['sport_id'] == 1) {
|
||||
$odds['active_spread'] = 1;
|
||||
}
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$flags['odds_totals'][] = $event->id;
|
||||
|
||||
if ($offer['goals_over_under']['odds'][1]['name'] == '2.5') {
|
||||
$odds['total'] = 2.5;
|
||||
$res = OddsTotal::where('event_id', $event->id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
$res = Odds3way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->difference = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->a3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
@@ -181,29 +123,111 @@ class Bet365
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DC
|
||||
*/
|
||||
if (isset($offer['double_chance'])) {
|
||||
|
||||
$data = $offer['double_chance']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['dc1x'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['dc12'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['dcx2'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_dc'][] = $event->id;
|
||||
|
||||
$res = OddsDc::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($odds);
|
||||
} else {
|
||||
$res->dc1x = $odds['dc1x'];
|
||||
$res->dc12 = $odds['dc12'];
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OU
|
||||
*/
|
||||
if (isset($offer['goals_over_under'])) {
|
||||
|
||||
$data = $offer['goals_over_under']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['over'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['under'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
if ($base['sport_id'] == 1) {
|
||||
$odds['active_spread'] = 1;
|
||||
}
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_totals'][] = $event->id;
|
||||
|
||||
if ($offer['goals_over_under']['odds'][1]['name'] == '2.5') {
|
||||
$odds['total'] = 2.5;
|
||||
$res = OddsTotal::where('event_id', $event->id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->difference = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GG NG
|
||||
*/
|
||||
if (isset($offer['both_teams_to_score'])) {
|
||||
$odds = [];
|
||||
$odds['gg'] = number_format($offer['both_teams_to_score']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['ng'] = number_format($offer['both_teams_to_score']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
$data = $offer['both_teams_to_score']['odds'] ?? [];
|
||||
|
||||
$flags['odds_ggng'][] = $event->id;
|
||||
if ($data) {
|
||||
|
||||
$res = OddsGgng::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
$odds = [];
|
||||
$odds['gg'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['ng'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($odds);
|
||||
} else {
|
||||
$res->gg = $odds['gg'];
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_ggng'][] = $event->id;
|
||||
|
||||
$res = OddsGgng::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($odds);
|
||||
} else {
|
||||
$res->gg = $odds['gg'];
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,25 +235,31 @@ class Bet365
|
||||
* DNB
|
||||
*/
|
||||
if (isset($offer['draw_no_bet'])) {
|
||||
$odds = [];
|
||||
$odds['dnb1'] = number_format($offer['draw_no_bet']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['dnb2'] = number_format($offer['draw_no_bet']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$res = OddsDnb::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
$data = $offer['draw_no_bet']['odds'] ?? [];
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
if ($data) {
|
||||
|
||||
$flags['odds_dnb'][] = $event->id;
|
||||
$odds = [];
|
||||
$odds['dnb1'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['dnb2'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
if (! $res) {
|
||||
OddsDnb::create($odds);
|
||||
} else {
|
||||
$res->dnb1 = $odds['dnb1'];
|
||||
$res->dnb2 = $odds['dnb2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
$res = OddsDnb::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_dnb'][] = $event->id;
|
||||
|
||||
if (! $res) {
|
||||
OddsDnb::create($odds);
|
||||
} else {
|
||||
$res->dnb1 = $odds['dnb1'];
|
||||
$res->dnb2 = $odds['dnb2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,34 +267,40 @@ class Bet365
|
||||
* 1X2 HT
|
||||
*/
|
||||
if (isset($offer['half_time_result'])) {
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($offer['half_time_result']['odds'][0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($offer['half_time_result']['odds'][1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($offer['half_time_result']['odds'][2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
$data = $offer['half_time_result']['odds'] ?? [];
|
||||
|
||||
$flags['odds_3ways_ht'][] = $event->id;
|
||||
if ($data) {
|
||||
|
||||
$res = Odds3wayHt::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
if (! $res) {
|
||||
Odds3wayHt::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_3ways_ht'][] = $event->id;
|
||||
|
||||
$res = Odds3wayHt::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3wayHt::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($flags as $table => $event_ids) {
|
||||
foreach ($events_collector as $table => $event_ids) {
|
||||
DB::table($table)->where('bookmaker_id', $bookmaker_id)->whereNotIn('event_id', $event_ids)->update(['flags' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Console\Commands\Nuh;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Logifuture
|
||||
{
|
||||
@@ -35,8 +36,6 @@ class Logifuture
|
||||
|
||||
Authentication::authenticate();
|
||||
|
||||
$flags = [];
|
||||
|
||||
foreach ($sportmap as $logifuture_sport_id => $sport_id) {
|
||||
|
||||
$matches = LogifutureData::load($logifuture_sport_id);
|
||||
@@ -65,8 +64,6 @@ class Logifuture
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'startime' => $event['starttime']]);
|
||||
|
||||
$flags[$sport_id][] = $event['id'];
|
||||
|
||||
switch ($sport_id) {
|
||||
case 1:
|
||||
Soccer::get($event, $match);
|
||||
@@ -94,15 +91,11 @@ class Logifuture
|
||||
}
|
||||
if ($event_id_collector) {
|
||||
EventBookmaker::whereNotIn('event_id', $event_id_collector)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->update(['in_feed' => 0]);
|
||||
}
|
||||
|
||||
$tables = [];
|
||||
$tables[1] = ['odds_3ways', 'odds_totals', 'odds_ggng', 'odds_dc', 'odds_tq'];
|
||||
$tables[2] = ['odds_2ways', 'odds_2ways_s1', 'odds_3ways', 'odds_totals', 'odds_points', 'odds_points_q1', 'odds_totals_q1'];
|
||||
$tables[3] = ['odds_totals', 'odds_points', 'odds_points_q1', 'odds_totals_q1'];
|
||||
$tables[5] = ['odds_2ways', 'odds_2ways_s1', 'odds_totals', 'odds_points'];
|
||||
foreach ($tables as $sport_id => $table) {
|
||||
DB::table($table)->where('bookmaker_id', $bookmaker_id)->whereNotIn('event_id', $flags[$sport_id])->update(['flags' => 0]);
|
||||
$tables = ['odds_2ways', 'odds_2ways_s1', 'odds_3ways', 'odds_totals', 'odds_points', 'odds_ggng', 'odds_dc', 'odds_tq', 'odds_points_q1', 'odds_totals_q1'];
|
||||
foreach ($tables as $table) {
|
||||
DB::table($table)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->whereNotIn('event_id', $event_id_collector)->update(['flags' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ use App\Models\EventBookmaker;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds
|
||||
{
|
||||
@@ -149,7 +150,7 @@ class Odds
|
||||
|
||||
$tables = ['odds_3ways', 'odds_dc', 'odds_ggng', 'odds_points', 'odds_points_q1', 'odds_totals', 'odds_totals_q1', 'odds_tq'];
|
||||
foreach ($tables as $table) {
|
||||
DB::table($table)->where('bookmaker_id', $bookmaker_id)->whereNotIn('event_id', $event_id_collector)->update(['flags' => 0]);
|
||||
DB::table($table)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->whereNotIn('event_id', $event_id_collector)->update(['flags' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace App\Console\Commands\Services;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Services\Tasks\DBMapper;
|
||||
use App\Console\Commands\Services\Tasks\GenerateAlarm;
|
||||
use App\Console\Commands\Services\Tasks\GenerateAlarms;
|
||||
use App\Console\Commands\Services\Tasks\GenerateSetting;
|
||||
use App\Console\Commands\Services\Tasks\MarketsList;
|
||||
use App\Console\Commands\Services\Tasks\MarketsState;
|
||||
@@ -26,8 +26,8 @@ class Services
|
||||
case 'Generate Setting':
|
||||
GenerateSetting::run();
|
||||
break;
|
||||
case 'Generate Alarm':
|
||||
GenerateAlarm::run();
|
||||
case 'Generate Alarms':
|
||||
GenerateAlarms::run();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OddsTable extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in new issue
Block a user