wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\FilterHandicap;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStorePoints;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Tennis
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$ml = [];
|
||||
$mls1 = [];
|
||||
$n_totals = [];
|
||||
$n_points = [];
|
||||
$c_totals = [];
|
||||
$c_points = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'T_12_1':
|
||||
$ml['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_12_2':
|
||||
$ml['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'T_121P_1':
|
||||
$mls1['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_121P_2':
|
||||
$mls1['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strpos($name, '@') !== false) {
|
||||
$pos = strpos($name, '@');
|
||||
$market = substr($name, 0, $pos);
|
||||
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'T_OUG':
|
||||
$n_totals[$name] = $value;
|
||||
$c_totals[$name] = $value;
|
||||
break;
|
||||
case 'T_GH':
|
||||
$n_points[$name] = $value;
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'T_HNDGAMES':
|
||||
$c_points[$name] = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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;
|
||||
|
||||
// ML
|
||||
if (\count($ml) == 2) {
|
||||
|
||||
$ml['margin'] = (float) Margin::calculate($ml, 1);
|
||||
|
||||
$ml = array_merge($ml, $base);
|
||||
|
||||
// Notice::note($ml, 'g');
|
||||
|
||||
$res = Odds2way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2way::create($ml);
|
||||
} else {
|
||||
$res->h2w = number_format($ml['h2w'], 2);
|
||||
$res->a2w = number_format($ml['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $ml['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($mls1) == 2) {
|
||||
|
||||
$mls1['margin'] = (float) Margin::calculate($mls1, 1);
|
||||
|
||||
$mls1 = array_merge($mls1, $base);
|
||||
|
||||
$res = Odds2wayS1::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2wayS1::create($ml);
|
||||
} else {
|
||||
$res->h2w = number_format($ml['h2w'], 2);
|
||||
$res->a2w = number_format($ml['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $mls1['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$_spreads = [];
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'T_OUG@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'T_HNDGAMES@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'T_OUG@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'T_GH@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
if (isset($_spreads['total'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user