set alatm for total and point only when same hcap or total
This commit is contained in:
1 parent
bfecd7b536
commit
a6ef8e74cc
3 files changed
+34
-8
No files matched your search
@@ -17,6 +17,11 @@ class AlarmLoadOdds
|
|||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
|
if (in_array($table, ['odds_totals', 'odds_totals_ht', 'odds_totals_q1'])) {
|
||||||
|
$arr[(int) $value->bookmaker_id]['total'] = (float) $value->total;
|
||||||
|
} elseif (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
|
||||||
|
$arr[(int) $value->bookmaker_id]['handicap'] = (float) $value->handicap;
|
||||||
|
}
|
||||||
if ($table == 'odds_dc') {
|
if ($table == 'odds_dc') {
|
||||||
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin * 2;
|
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin * 2;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use App\Models\EventBookmaker;
|
|||||||
|
|
||||||
class AlarmStore
|
class AlarmStore
|
||||||
{
|
{
|
||||||
public static function get($event_id, $oddnames, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
|
public static function get($table, $event_id, $oddnames, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
|
||||||
{
|
{
|
||||||
if (! $compare_odds) {
|
if (! $compare_odds) {
|
||||||
return;
|
return;
|
||||||
@@ -18,12 +18,37 @@ class AlarmStore
|
|||||||
|
|
||||||
$favorit = min($client_odds);
|
$favorit = min($client_odds);
|
||||||
|
|
||||||
|
// if ($table == 'odds_points') {
|
||||||
|
// dd($compare_odds);
|
||||||
|
// }
|
||||||
|
|
||||||
$update_array = [];
|
$update_array = [];
|
||||||
foreach ($oddnames as $fieldname => $oddname) {
|
foreach ($oddnames as $fieldname => $oddname) {
|
||||||
if ($client_odds[$oddname] == $favorit) {
|
if ($client_odds[$oddname] == $favorit) {
|
||||||
|
|
||||||
$threshold = $client_odds[$oddname] - $compare_odds[$oddname];
|
$threshold = $client_odds[$oddname] - $compare_odds[$oddname];
|
||||||
|
|
||||||
|
if (in_array($table, ['odds_totals', 'odds_totals_ht', 'odds_totals_q1'])) {
|
||||||
|
if ($client_odds['total'] = (float) $compare_odds['total']) {
|
||||||
|
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||||
|
}
|
||||||
|
} elseif (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
|
||||||
|
if ($client_odds['handicap'] = (float) $compare_odds['handicap']) {
|
||||||
|
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$update_array[$fieldname] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setAlarm(&$update_array, $fieldname, $threshold, $alarm_threshold)
|
||||||
|
{
|
||||||
if ($threshold > $alarm_threshold[3]) {
|
if ($threshold > $alarm_threshold[3]) {
|
||||||
// ROT
|
// ROT
|
||||||
$update_array[$fieldname] = 3;
|
$update_array[$fieldname] = 3;
|
||||||
@@ -37,11 +62,5 @@ class AlarmStore
|
|||||||
// Reset Alarm
|
// Reset Alarm
|
||||||
$update_array[$fieldname] = 0;
|
$update_array[$fieldname] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$update_array[$fieldname] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,11 +66,13 @@ class GenerateAlarms
|
|||||||
|
|
||||||
$odds = AlarmLoadOdds::get($event->event_id, $table, $oddnames[$table]);
|
$odds = AlarmLoadOdds::get($event->event_id, $table, $oddnames[$table]);
|
||||||
|
|
||||||
|
// check if margin is > 1
|
||||||
$compare_odds = AlarmFilterCompare::get($odds, $filter);
|
$compare_odds = AlarmFilterCompare::get($odds, $filter);
|
||||||
|
|
||||||
|
// check if client has odds
|
||||||
$client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id);
|
$client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id);
|
||||||
|
|
||||||
AlarmStore::get($event->event_id, $oddnames[$table], $client_bookmaker_id, $alarm_threshold[$multiline_id], $compare_odds, $client_odds);
|
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