Files
nuhodds_fi4/app/Console/Commands/Grapper/Logifuture/Basketball.php
T
2026-01-19 18:36:07 +01:00

125 lines
4.2 KiB
PHP

<?php
namespace App\Console\Commands\Grapper\Logifuture;
use App\Console\Commands\Grapper\Logifuture\Odds\StorePoints;
use App\Console\Commands\Grapper\Logifuture\Odds\StoreTotals;
use App\Console\Commands\Grapper\Logifuture\Tools\FilterHandicap;
use App\Console\Commands\Nuh;
class Basketball
{
public static function get(&$event, $match)
{
$n_totals = [];
$n_totals_qt = [];
$n_points = [];
$n_points_qt = [];
$c_totals = [];
$c_totals_qt = [];
$c_points = [];
$c_points_qt = [];
foreach ($match['odds'] as $name => $value) {
/*
case 'B_1X2_1':
$event['h3w'] = $value;
break;
case 'B_1X2_X':
$event['d3w'] = $value;
break;
case 'B_1X2_2':
$event['a3w'] = $value;
break;
case 'B_12_1':
$_bai_2way['h2w'] = $value;
break;
case 'B_12_2':
$_bai_2way['a2w'] = $value;
break;
*/
if (strpos($name, '@') !== false) {
$pos = strpos($name, '@');
$market = substr($name, 0, $pos);
switch ($market) {
// NIGERIA
case 'B_OUN':
$n_totals[$name] = number_format($value, 2);
break;
case 'B_1QOU':
$n_totals_qt[$name] = number_format($value, 2);
break;
case 'B_H':
$n_points[$name] = number_format($value, 2);
break;
case 'B_1QH':
$n_points_qt[$name] = number_format($value, 2);
break;
// COLOMBIA
case 'B_OUHND':
$c_totals[$name] = number_format($value, 2);
break;
case 'B_OUHND1P':
$c_totals_qt[$name] = number_format($value, 2);
break;
case 'B_12HND':
$c_points[$name] = number_format($value, 2);
break;
case 'B_12HND1P':
$c_points_qt[$name] = number_format($value, 2);
break;
}
}
}
$_spreads = [];
// COLUMBIA
if ($c_totals) {
FilterHandicap::filter($_spreads['total'], 'B_OUHND@', $c_totals, ['over', 'under', 'total']);
}
if ($c_totals_qt) {
FilterHandicap::filter($_spreads['total_qt'], 'B_OUHND1P@', $c_totals_qt, ['over', 'under', 'total']);
}
if ($c_points) {
FilterHandicap::filter($_spreads['point'], 'B_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
}
if ($c_points_qt) {
FilterHandicap::filter($_spreads['point_qt'], 'B_12HND1P@', $c_points_qt, ['hth1', 'hth2', 'hcap']);
}
// NIGERIA
if ($n_totals) {
FilterHandicap::filter($_spreads['total'], 'B_OUN@', $n_totals, ['over', 'under', 'total']);
}
if ($n_totals_qt) {
FilterHandicap::filter($_spreads['total_qt'], 'B_1QOU@', $n_totals_qt, ['over', 'under', 'total']);
}
if ($n_points) {
FilterHandicap::filter($_spreads['point'], 'B_H@', $n_points, ['hth1', 'hth2', 'hcap']);
}
if ($n_points_qt) {
FilterHandicap::filter($_spreads['point_qt'], 'B_1QH@', $n_points_qt, ['hth1', 'hth2', 'hcap']);
}
$base = [];
$base['event_id'] = $event['id'];
$base['bookmaker_id'] = $event['bookmaker_id'];
$base['sport_id'] = $event['sport_id'];
$base['provider_id'] = Nuh::$options['provider_id'];
$base['bmoid'] = $event['event_id'];
$base['flags'] = 1;
if (isset($_spreads['total'])) {
StoreTotals::store($_spreads['total'], $base);
}
if (isset($_spreads['point'])) {
StorePoints::store($_spreads['point'], $base);
}
}
}