wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,124 @@
|
||||
<?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;
|
||||
|
||||
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'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
<?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\LogifutureStorePointsQ1;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotalsQ1;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Icehockey
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$ml = [];
|
||||
$mls1 = [];
|
||||
$_3way = [];
|
||||
$n_totals = [];
|
||||
$n_points = [];
|
||||
$c_totals = [];
|
||||
$c_points = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'IH_1X2_1':
|
||||
$_3way['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_X':
|
||||
$_3way['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_2':
|
||||
$_3way['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'IH_12_1':
|
||||
$ml['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_12_2':
|
||||
$ml['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'IH_12OTAP_1':
|
||||
$mls1['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_12OTAP_2':
|
||||
$mls1['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strpos($name, '@') !== false) {
|
||||
$pos = strpos($name, '@');
|
||||
$market = substr($name, 0, $pos);
|
||||
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'IH_TF':
|
||||
$n_totals[$name] = $value;
|
||||
break;
|
||||
case 'IH_HR1':
|
||||
$n_points[$name] = $value;
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'IH_OUHND':
|
||||
$c_totals[$name] = $value;
|
||||
break;
|
||||
case 'IH_12HND':
|
||||
$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;
|
||||
|
||||
// 1x2
|
||||
if (\count($_3way) == 3) {
|
||||
|
||||
$_3way['margin'] = (float) Margin::calculate($_3way, 1);
|
||||
|
||||
$_3way = array_merge($_3way, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($_3way);
|
||||
} else {
|
||||
$res->h3w = number_format($_3way['h3w'], 2);
|
||||
$res->d3w = number_format($_3way['d3w'], 2);
|
||||
$res->a3w = number_format($_3way['a3w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_3way['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// ML
|
||||
if (\count($ml) == 2) {
|
||||
|
||||
$ml['margin'] = (float) Margin::calculate($ml, 1);
|
||||
|
||||
$ml = array_merge($ml, $base);
|
||||
|
||||
$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($mls1);
|
||||
} else {
|
||||
$res->h2w = number_format($mls1['h2w'], 2);
|
||||
$res->a2w = number_format($mls1['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $mls1['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'IH_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'IH_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'IH_TF@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'IH_HR1@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
if (isset($_spreads['total'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['total_qt'])) {
|
||||
LogifutureStoreTotalsQ1::store($_spreads['total_qt'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
if (isset($_spreads['point_qt'])) {
|
||||
LogifutureStorePointsQ1::store($_spreads['point_qt'], $base);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Soccer
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$_3way = [];
|
||||
$_total = [];
|
||||
$_ggng = [];
|
||||
$_dc = [];
|
||||
$_tq = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'S_1X2_1':
|
||||
$_3way['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_X':
|
||||
$_3way['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_2':
|
||||
$_3way['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_OU@2.5_O':
|
||||
$_total['over'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_OU@2.5_U':
|
||||
$_total['under'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_GGNG_Y':
|
||||
$_ggng['gg'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_GGNG_N':
|
||||
$_ggng['ng'] = number_format($value, 2);
|
||||
break;
|
||||
// case 'S_DNB_1':
|
||||
// break;
|
||||
// case 'S_DNB_2':
|
||||
// break;
|
||||
case 'S_DC_12':
|
||||
$_dc['dc12'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_1X':
|
||||
$_dc['dc1x'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_X2':
|
||||
$_dc['dcx2'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_12QUALIFY_1':
|
||||
$_tq['htq'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_12QUALIFY_2':
|
||||
$_tq['atq'] = number_format($value, 2);
|
||||
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;
|
||||
|
||||
// 1x2
|
||||
if (\count($_3way) == 3) {
|
||||
|
||||
$_3way['margin'] = (float) Margin::calculate($_3way, 1);
|
||||
|
||||
$_3way = array_merge($_3way, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($_3way);
|
||||
} else {
|
||||
$res->h3w = number_format($_3way['h3w'], 2);
|
||||
$res->d3w = number_format($_3way['d3w'], 2);
|
||||
$res->a3w = number_format($_3way['a3w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_3way['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
// OU
|
||||
if (\count($_total) == 2) {
|
||||
|
||||
$_total['margin'] = (float) Margin::calculate($_total, 1);
|
||||
$_total['total'] = 2.5;
|
||||
$_total['active_spread'] = 1;
|
||||
|
||||
$_total = array_merge($_total, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $event['id'])
|
||||
->where('bookmaker_id', $event['bookmaker_id'])
|
||||
->where('total', $_total['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($_total);
|
||||
} else {
|
||||
$res->over = number_format($_total['over'], 2);
|
||||
$res->under = number_format($_total['under'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_total['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
// GG NG
|
||||
if (\count($_ggng) == 2) {
|
||||
|
||||
$_ggng['margin'] = (float) Margin::calculate($_ggng, 1);
|
||||
|
||||
$_ggng = array_merge($_ggng, $base);
|
||||
|
||||
$res = OddsGgng::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($_ggng);
|
||||
} else {
|
||||
$res->gg = number_format($_ggng['gg'], 2);
|
||||
$res->ng = number_format($_ggng['ng'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_ggng['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// DC
|
||||
if (\count($_dc) == 3) {
|
||||
|
||||
$_dc['margin'] = (float) Margin::calculate($_dc, 1);
|
||||
|
||||
$_dc = array_merge($_dc, $base);
|
||||
|
||||
$res = OddsDc::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($_dc);
|
||||
} else {
|
||||
$res->dc1x = number_format($_dc['dc1x'], 2);
|
||||
$res->dc12 = number_format($_dc['dc12'], 2);
|
||||
$res->dcx2 = number_format($_dc['dcx2'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_dc['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// TQ
|
||||
if (\count($_tq) == 2) {
|
||||
|
||||
$_tq['margin'] = (float) Margin::calculate($_tq, 1);
|
||||
|
||||
$_tq = array_merge($_tq, $base);
|
||||
|
||||
$res = OddsTq::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($_tq);
|
||||
} else {
|
||||
$res->htq = number_format($_tq['htq'], 2);
|
||||
$res->atq = number_format($_tq['atq'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_tq['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
class ActiveHandicap
|
||||
{
|
||||
public static function set(&$_spreads)
|
||||
{
|
||||
$tmp = 10000;
|
||||
$hcap = false;
|
||||
foreach ($_spreads as $key => $value) {
|
||||
$x = 0;
|
||||
foreach ($value as $k => $v) {
|
||||
if ($x == 0) {
|
||||
$x = $v;
|
||||
} else {
|
||||
$x -= $v;
|
||||
}
|
||||
}
|
||||
$x = abs($x);
|
||||
if ($x < $tmp) {
|
||||
$hcap = $key;
|
||||
$tmp = $x;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_spreads as $key => $value) {
|
||||
if ($key == $hcap) {
|
||||
$_spreads[$key]['active_spread'] = 1;
|
||||
} else {
|
||||
$_spreads[$key]['active_spread'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
public static function authenticate()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = Nuh::$options['base_url'].'/v1/authentication/token';
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_auth.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, ['url' => $url, 'password' => config('env.logifuture_token')]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||
'username' => 'nuhodds',
|
||||
'password' => config('env.logifuture_token'),
|
||||
]));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'accept: application/json',
|
||||
'content-type: application/json',
|
||||
]);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
$data = json_decode($file, true);
|
||||
|
||||
$header = [];
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
Logifuture::$auth_header = $header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
class FilterHandicap
|
||||
{
|
||||
public static function filter(&$_spreads, $filter, $data, $oddnames)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$key = str_replace($filter, '', $key);
|
||||
|
||||
if (strpos($key, '_O') !== false) {
|
||||
$hcap = str_replace('_O', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1H') !== false) {
|
||||
$hcap = str_replace('_1H', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1') !== false) {
|
||||
$hcap = str_replace('_1', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_U') !== false) {
|
||||
$hcap = str_replace('_U', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2H') !== false) {
|
||||
$hcap = str_replace('_2H', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2') !== false) {
|
||||
$hcap = str_replace('_2', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class LogifutureData
|
||||
{
|
||||
public static $testfiles = '/Console/Commands/TestFiles/';
|
||||
|
||||
public static function load($logifuture_sport_id)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
|
||||
$filename = app_path().self::$testfiles.str_replace(' ', '_', strtolower(Nuh::$options['sport'].'_'.Nuh::$options['provider'])).'.json';
|
||||
|
||||
if ($read) {
|
||||
if ($debug) {
|
||||
Notice::note('data read localy', 'g');
|
||||
}
|
||||
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
|
||||
$url = Nuh::$options['base_url'].'/v1/matches?sportId='.$logifuture_sport_id;
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_data.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
||||
'url' => $url,
|
||||
'header' => json_encode(Logifuture::$auth_header),
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, Logifuture::$auth_header);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
if ($save) {
|
||||
|
||||
file_put_contents($filename, $file);
|
||||
|
||||
Notice::note('file saved localy', 'g');
|
||||
}
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
echo curl_error($ch);
|
||||
}
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsPoint;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStorePoints
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $handicap => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['home'] = $value['ele1'];
|
||||
$odds['away'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPoint::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPoint::create($odds);
|
||||
} else {
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsPointQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStorePointsQ1
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $handicap => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['home'] = $value['ele1'];
|
||||
$odds['away'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['flags'] = 1;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPointQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPointQ1::create($odds);
|
||||
} else {
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStoreTotals
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $total => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['over'] = $value['ele1'];
|
||||
$odds['under'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['flags'] = 1;
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsTotalQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStoreTotalsQ1
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $total => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['over'] = $value['ele1'];
|
||||
$odds['under'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['flags'] = 1;
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotalQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotalQ1::create($odds);
|
||||
} else {
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MapEvent
|
||||
{
|
||||
public static function filter($sport_id, $match)
|
||||
{
|
||||
$event = [];
|
||||
$event['event_id'] = (int) $match['id'];
|
||||
$event['bookmaker_id'] = Nuh::$options['bookmaker_id'];
|
||||
$event['betradar_id'] = (int) preg_replace('"\D"', '', $match['externalId']);
|
||||
$event['sport_id'] = $sport_id;
|
||||
$event['provider_id'] = Nuh::$options['provider_id'];
|
||||
$event['starttime'] = Carbon::parse($match['startDate'])->toDateTimeString();
|
||||
$event['country'] = $match['sportCategory'];
|
||||
$event['group_id'] = (int) $match['tournamentId'];
|
||||
$event['group'] = addslashes($match['tournamentName']);
|
||||
|
||||
$str = str_replace('||', '|', $match['description']);
|
||||
$str = trim(str_replace('|', ' ', $str));
|
||||
if (Nuh::$options['bookmaker_id'] == 36) {
|
||||
$teams = explode(' v ', $str);
|
||||
} else {
|
||||
$teams = explode(' - ', $str);
|
||||
}
|
||||
$event['home'] = addslashes($teams[0]);
|
||||
$event['away'] = addslashes($teams[1]);
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user