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,38 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds2way;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_2Way
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['h2w'] = (float) $value->o1;
$odds['a2w'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
$res = Odds2way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
Odds2way::create($odds);
} elseif (! $block_update) {
$res->h2w = $odds['h2w'];
$res->a2w = $odds['a2w'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,38 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds2wayS1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_2WayS1
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['h2w'] = (float) $value->o1;
$odds['a2w'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
$res = Odds2wayS1::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
Odds2wayS1::create($odds);
} elseif (! $block_update) {
$res->h2w = $odds['h2w'];
$res->a2w = $odds['a2w'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,40 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_3Way
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
$res = Odds3way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
Odds3way::create($odds);
} elseif (! $block_update) {
$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,40 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3wayHt;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_3WayHt
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
$res = Odds3wayHt::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
Odds3wayHt::create($odds);
} elseif (! $block_update) {
$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,40 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsDc;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Dc
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['dc1x'] = (float) $value->o1;
$odds['dc12'] = (float) $value->o2;
$odds['dcx2'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dcx2']], 1);
$res = OddsDc::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
OddsDc::create($odds);
} elseif (! $block_update) {
$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,38 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsDnb;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Dnb
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['dnb1'] = (float) $value->o1;
$odds['dnb2'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['dnb1'], $odds['dnb2']], 1);
$res = OddsDnb::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
OddsDnb::create($odds);
} elseif (! $block_update) {
$res->dnb1 = $odds['dnb1'];
$res->dnb2 = $odds['dnb2'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,38 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsGgng;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Ggng
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['gg'] = (float) $value->o1;
$odds['ng'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
$res = OddsGgng::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
OddsGgng::create($odds);
} elseif (! $block_update) {
$res->gg = $odds['gg'];
$res->ng = $odds['ng'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,55 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPoint;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Points
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['home'] = (float) $value->o1;
$odds['away'] = (float) $value->o2;
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$res = OddsPoint::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('handicap', $odds['handicap'])
->first();
if (! $res) {
OddsPoint::create($odds);
} elseif (! $block_update) {
$res->home = $odds['home'];
$res->away = $odds['away'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_points');
}
}
@@ -1,54 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPointHt;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_PointsHt
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['home'] = (float) $value->o1;
$odds['away'] = (float) $value->o2;
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$res = OddsPointHt::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('handicap', $odds['handicap'])
->first();
if (! $res) {
OddsPointHt::create($odds);
} elseif (! $block_update) {
$res->home = $odds['home'];
$res->away = $odds['away'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_points_ht');
}
}
@@ -1,54 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPointQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_PointsQ1
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['home'] = (float) $value->o1;
$odds['away'] = (float) $value->o2;
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$res = OddsPointQ1::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('handicap', $odds['handicap'])
->first();
if (! $res) {
OddsPointQ1::create($odds);
} elseif (! $block_update) {
$res->home = $odds['home'];
$res->away = $odds['away'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_points_q1');
}
}
@@ -1,60 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Totals
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['over'] = (float) $value->o1;
$odds['under'] = (float) $value->o2;
$odds['total'] = (float) $value->o3;
}
if ($odds['sport_id'] == 1) {
if ((float) $odds['total'] != 2.5) {
return;
}
} else {
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
}
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$res = OddsTotal::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('total', $odds['total'])
->first();
if (! $res) {
OddsTotal::create($odds);
} elseif (! $block_update) {
$res->over = $odds['over'];
$res->under = $odds['under'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_totals');
}
}
@@ -1,61 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotalHt;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_TotalsHt
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['over'] = (float) $value->o1;
$odds['under'] = (float) $value->o2;
$odds['total'] = (float) $value->o3;
}
if ($odds['sport_id'] == 1) {
if ((float) $odds['total'] != 2.5) {
return;
}
} else {
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
}
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$res = OddsTotalHt::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('total', $odds['total'])
->first();
if (! $res) {
OddsTotalHt::create($odds);
} elseif (! $block_update) {
$res->over = $odds['over'];
$res->under = $odds['under'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_totals_ht');
}
}
@@ -1,60 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotalQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_TotalsQ1
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['over'] = (float) $value->o1;
$odds['under'] = (float) $value->o2;
$odds['total'] = (float) $value->o3;
}
if ($odds['sport_id'] == 1) {
if ((float) $odds['total'] != 2.5) {
return;
}
} else {
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
}
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$res = OddsTotalQ1::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('total', $odds['total'])
->first();
if (! $res) {
OddsTotalQ1::create($odds);
} elseif (! $block_update) {
$res->over = $odds['over'];
$res->under = $odds['under'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
ActiveSpread::collect($odds, 'odds_totals_q1');
}
}
@@ -1,38 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsTq;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class Odds_Tq
{
public static function grap($odds, $offer)
{
$block_update = Nuh::$options['b'] ?? 0;
foreach ($offer as $value) {
$odds['htq'] = (float) $value->o1;
$odds['atq'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
$res = OddsTq::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
OddsTq::create($odds);
} elseif (! $block_update) {
$res->htq = $odds['htq'];
$res->atq = $odds['atq'];
$res->flags = 1;
$res->margin = $odds['margin'];
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -1,68 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds\Tools;
use Illuminate\Support\Facades\DB;
class ActiveSpread
{
public static $collector = [];
public static function start()
{
self::$collector = [];
}
public static function collect($odds, $table)
{
if (! isset(self::$collector[$table])) {
self::$collector[$table]['difference'] = $odds['difference'];
if (isset($odds['handicap'])) {
self::$collector[$table]['active_spread'] = $odds['handicap'];
} else {
self::$collector[$table]['active_spread'] = $odds['total'];
}
} elseif ($odds['difference'] < self::$collector[$table]['difference']) {
self::$collector[$table]['difference'] = $odds['difference'];
if (isset($odds['handicap'])) {
self::$collector[$table]['active_spread'] = $odds['handicap'];
} else {
self::$collector[$table]['active_spread'] = $odds['total'];
}
}
}
public static function set($event_id, $bookmaker_id)
{
foreach (self::$collector as $table => $value) {
DB::transaction(function () use ($table, $event_id, $bookmaker_id) {
DB::table($table)->where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->update(['active_spread' => 0]);
}, 5);
if (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
DB::transaction(function () use ($table, $event_id, $bookmaker_id, $value) {
DB::table($table)
->where('event_id', $event_id)
->where('bookmaker_id', $bookmaker_id)
->where('handicap', (float) $value['active_spread'])
->update(['active_spread' => 1]);
}, 5);
} else {
DB::transaction(function () use ($table, $event_id, $bookmaker_id, $value) {
DB::table($table)
->where('event_id', $event_id)
->where('bookmaker_id', $bookmaker_id)
->where('total', (float) $value['active_spread'])
->update(['active_spread' => 1]);
}, 5);
}
}
}
}
@@ -1,97 +0,0 @@
/*************************************************
* https://xml2.txodds.com/feed/odds_types.php
* BETTYPE IDS
0 3-WAY
1 2-WAY
3 POINTS
4 TOTALS
131073 MONEY LINE - Q1
65536 3-WAY HALF TIME
65540 TOTALS HALF TIME
65539 POINTS HALF TIME
131075 POINTS QUARTER TIME
131076 TOTALS QUARTER TIME
5242880 DOUBLE CHANCE
6291457 DRAW NO BET
11534337 GG/NG (both teams to score)
7340033 TO PROGRESS (to qualify)
Not used:
5 Asian
131072 3 WAY QUARTER TIME
262148 TOTALS OVER TIME
262147 POINTS OVER TIME
65537 2-WAY HALF TIME
327680 3-WAY 2ND HALF
327681 2-WAY 2ND HALF
327683 POINT 2ND HALF
327684 TOTALS 2ND HALF
1048577 GOAL / NO GOAL
2097153 ODD / EVEN
4194304 TOTAL GOALS
8388608 1X2 EURO HANDCIAP
9437188 TOTAL CORNERS
9502724 TOTAL CORNERS 1ST HALF
20971520 3-WAY CORNERS
28311555 HANDICAP SETS
28311556 TOTAL SETS
*************************************************/
switch (Nuh::$options['sport_id']) {
case 1:
/**
* 0 3-WAY
* 4 TOTALS
* 65536 3-WAY HALF TIME
* 65540 TOTALS HALF TIME
* 11534337 GG/NG (both teams to score)
* 5242880 DOUBLE CHANCE
* 7340033 TO PROGRESS (to qualify)
* 6291457 DRAW NO BET
*/
$markets = '0,4,65536,65540,11534337,5242880,7340033,6291457';
break;
case 2:
/**
* 0 3-WAY
* 1 2-WAY
* 3 POINTS
* 4 TOTALS
* 131075 POINTS QUARTER TIME
* 131076 TOTALS QUARTER TIME
*/
$markets = '0,1,3,4,131076,131075';
break;
case 3:
/**
* 1 2-WAY
* 3 POINTS
* 4 TOTALS
* 65539 POINTS HALF TIME
* 65540 TOTALS HALF TIME
* 131075 POINTS QUARTER TIME
* 131076 TOTALS QUARTER TIME
*/
$markets = '1,3,4,65539,65540,131075,131076';
break;
case 5:
/**
* 1 2-WAY
* 131073 MONEY LINE - Q1
* 3 POINTS
* 4 TOTALS
*/
$markets = '1,3,4,131073';
break;
default:
Notice::note('sport not defined', 'r', 1);
break;
}