wip del err

This commit is contained in:
salam committed 2026-10-04 15:22:39 +02:00
1 parent 812736ca9a
commit 9bcd4432c6
1210 files changed
-220941

No files matched your search

@@ -1,35 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
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;
}
}
}
}
@@ -1,26 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Console\Commands\Grapper\Logifuture\Tools\ActiveHandicap;
class FilterHandicap
{
public static function get($_spreads)
{
ActiveHandicap::set($_spreads);
$_points = [];
foreach ($_spreads as $handicap => $value) {
if (fmod(abs($handicap), 1) == 0.5) {
if ($value[1714] > 1 and $value[1715] > 1) {
$_points[$handicap]['home'] = number_format($value[1714], 2);
$_points[$handicap]['away'] = number_format($value[1715], 2);
}
}
}
return $_points;
}
}
@@ -1,26 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
class FilterHandicapQ1
{
public static function get($_array)
{
$_points = [];
foreach ($_array as $key => $value) {
$t = explode('_', $key);
$matchpart = $t[0];
$handicap = (float) $t[1];
if ($matchpart == 1) {
if (fmod(abs($handicap), 1) == 0.5) {
if ($value[1714] > 1 and $value[1715] > 1) {
$_points[$handicap]['home'] = number_format($value[1714], 2);
$_points[$handicap]['away'] = number_format($value[1715], 2);
}
}
}
}
return $_points;
}
}
@@ -1,30 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
class FilterTotals
{
public static function get($_array, $sport_id)
{
$_totals = [];
foreach ($_array as $total => $value) {
if ($sport_id == 1) {
if ($total == 2.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
}
}
} else {
if (fmod(abs($total), 1) == 0.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
}
}
}
}
return $_totals;
}
}
@@ -1,26 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
class FilterTotalsQ1
{
public static function get($_array, $sport_id)
{
$_totals = [];
foreach ($_array as $key => $value) {
$t = explode('_', $key);
$matchpart = $t[0];
$total = (float) $t[1];
if ($matchpart == 1) {
if (fmod(abs($total), 1) == 0.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
}
}
}
}
return $_totals;
}
}
@@ -1,37 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\Odds3way;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStore1x2
{
public static function store($value, $base)
{
$odds = [];
$odds['h3w'] = number_format($value['static'][1], 2) ?? 1;
$odds['d3w'] = number_format($value['static'][2], 2) ?? 1;
$odds['a3w'] = number_format($value['static'][3], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = Odds3way::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
if (! $res) {
Odds3way::create($odds);
} else {
$res->h3w = $odds['h3w'];
$res->d3w = $odds['d3w'];
$res->a3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,39 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsDc;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStoreDc
{
public static function store($value, $base)
{
$odds = [];
$odds['dc1x'] = number_format($value['static'][9], 2) ?? 1;
$odds['dc12'] = number_format($value['static'][10], 2) ?? 1;
$odds['dcx2'] = number_format($value['static'][11], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = OddsDc::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
if (! $res) {
OddsDc::create($odds);
} else {
$res->dc1x = $odds['dc1x'];
$res->dc12 = $odds['dc12'];
$res->dcx2 = $odds['dcx2'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,36 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsGgng;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStoreGgng
{
public static function store($value, $base)
{
$odds = [];
$odds['gg'] = number_format($value['static'][74], 2) ?? 1;
$odds['ng'] = number_format($value['static'][76], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = OddsGgng::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
if (! $res) {
OddsGgng::create($odds);
} else {
$res->gg = $odds['gg'];
$res->ng = $odds['ng'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsPoint;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStorePoints
{
public static function store($data, $base)
{
ActiveHandicap::set($data);
foreach ($data as $handicap => $value) {
$odds = $value;
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 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->flags = 1;
$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->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsPointQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStorePointsQ1
{
public static function store($data, $base)
{
ActiveHandicap::set($data);
foreach ($data as $handicap => $value) {
$odds = $value;
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 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 = 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->flags = 1;
$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->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStoreTotals
{
public static function store($data, $base)
{
ActiveHandicap::set($data);
foreach ($data as $total => $value) {
$odds = $value;
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['active_spread'] = $value['active_spread'];
$odds['total'] = $total;
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['flags'] = 1;
$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->flags = 1;
$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->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTotalQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStoreTotalsQ1
{
public static function store($data, $base)
{
ActiveHandicap::set($data);
foreach ($data as $total => $value) {
$odds = $value;
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['active_spread'] = $value['active_spread'];
$odds['total'] = $total;
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['flags'] = 1;
$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->flags = 1;
$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->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
}
@@ -1,36 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTq;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class MaglooStoreTq
{
public static function store($value, $base)
{
$odds = [];
$odds['htq'] = number_format($value['static'][4], 2) ?? 1;
$odds['atq'] = number_format($value['static'][5], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds = array_merge($odds, $base);
$odds['flags'] = 1;
$res = OddsTq::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
if (! $res) {
OddsTq::create($odds);
} else {
$res->flags = 1;
$res->htq = $odds['htq'];
$res->atq = $odds['atq'];
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}