alarm wip

This commit is contained in:
salam committed 2026-01-27 20:13:41 +01:00
1 parent d81af0b02b
commit 04b17abd30
15 files changed
+302 -61

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Actions;
use App\Models\EventBookmaker;
use App\Models\OddsTable;
class AlarmStatistic
{
public static function load()
{
$res = OddsTable::select('name', 'fieldnames')->get();
$fields = [];
foreach ($res as $value) {
$fields[$value->name] = explode(',', $value->fieldnames);
}
$res = EventBookmaker::select('alarm_2w_h2w', 'alarm_2w_a2w', 'alarm_2ws1_h2w', 'alarm_2ws1_a2w', 'alarm_3w_h3w', 'alarm_3w_d3w', 'alarm_3w_a3w', 'alarm_3wht_h3w', 'alarm_3wht_d3w', 'alarm_3wht_a3w', 'alarm_dc_dc1x', 'alarm_dc_dc12', 'alarm_dc_dcx2', 'alarm_dbn_dnb1', 'alarm_dbn_dnb2', 'alarm_ggng_gg', 'alarm_ggng_ng', 'alarm_po_home', 'alarm_po_away', 'alarm_poht_home', 'alarm_poht_away', 'alarm_poq1_home', 'alarm_poq1_away', 'alarm_to_over', 'alarm_to_under', 'alarm_toht_over', 'alarm_toht_under', 'alarm_toq1_over', 'alarm_toq1_under', 'alarm_tq_htq', 'alarm_tq_atq')
->where('bookmaker_id', auth()->user()->bookmaker_id)
->where('sport_id', auth()->user()->sport_id)
->get()
->toArray();
$arr = [];
foreach ($res as $value) {
foreach ($fields as $table => $names) {
foreach ($names as $name) {
$val = (int) $value[$name];
if ($val) {
if (isset($arr[$table][$val])) {
$arr[$table][$val]++;
} else {
$arr[$table][$val] = 1;
}
}
}
}
}
return $arr;
}
}