renewd grapper wip
This commit is contained in:
1 parent
8f1aeafe46
commit
4afe60a957
55 files changed
+1389
-823
No files matched your search
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\PrinzipalHandicap;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
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, &$_spreads, $match)
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$n_totals = [];
|
||||
$n_totals_qt = [];
|
||||
@@ -76,61 +77,48 @@ class Basketball
|
||||
}
|
||||
}
|
||||
|
||||
dd($n_totals);
|
||||
|
||||
$_spreads = [];
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'B_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
FilterHandicap::filter($_spreads['total'], 'B_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_totals_qt) {
|
||||
PrinzipalHandicap::filter($_spreads['total_qt'], 'B_OUHND1P@', $c_totals_qt, ['over', 'under', 'total']);
|
||||
FilterHandicap::filter($_spreads['total_qt'], 'B_OUHND1P@', $c_totals_qt, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'B_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
FilterHandicap::filter($_spreads['point'], 'B_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
if ($c_points_qt) {
|
||||
PrinzipalHandicap::filter($_spreads['point_qt'], 'B_12HND1P@', $c_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
FilterHandicap::filter($_spreads['point_qt'], 'B_12HND1P@', $c_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'B_OUN@', $n_totals, ['over', 'under', 'total']);
|
||||
FilterHandicap::filter($_spreads['total'], 'B_OUN@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_totals_qt) {
|
||||
PrinzipalHandicap::filter($_spreads['total_qt'], 'B_1QOU@', $n_totals_qt, ['over', 'under', 'total']);
|
||||
FilterHandicap::filter($_spreads['total_qt'], 'B_1QOU@', $n_totals_qt, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'B_H@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
FilterHandicap::filter($_spreads['point'], 'B_H@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
if ($n_points_qt) {
|
||||
PrinzipalHandicap::filter($_spreads['point_qt'], 'B_1QH@', $n_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
FilterHandicap::filter($_spreads['point_qt'], 'B_1QH@', $n_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
dd($n_totals);
|
||||
$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 (\count($n_totals) == 2) {
|
||||
|
||||
$_total['margin'] = (float) Margin::calculate($n_totals, 1);
|
||||
|
||||
$_total = array_merge($_total, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $event['id'])
|
||||
->where('bookmaker_id', $event['bookmaker_id'])
|
||||
->where('total', $event['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($_total);
|
||||
} else {
|
||||
$res->over = number_format($_total['over'], 2);
|
||||
$res->under = number_format($_total['under'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_total['margin'];
|
||||
$res->save();
|
||||
}
|
||||
if (isset($_spreads['total'])) {
|
||||
StoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
StorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user