multi betts wip

This commit is contained in:
salam committed 2026-01-09 12:55:18 +01:00
1 parent 1aa044fff1
commit b39196c9eb
62 files changed
+1237 -208

No files matched your search

@@ -31,7 +31,7 @@ class Willhill
*/
$bookmaker_id = 42;
$res = Event::with('odds_3way')
$res = Event::with('odds_3ways')
->where('betsapi_id', 0)
->where('sport_id', $sport_id)
->where('starttime', '>', Carbon::now())
+15 -5
View File
@@ -5,14 +5,18 @@ namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Grapper\TxOdds\Odds\_2Way;
use App\Console\Commands\Grapper\TxOdds\Odds\_2WayS1;
use App\Console\Commands\Grapper\TxOdds\Odds\_3Way;
use App\Console\Commands\Grapper\TxOdds\Odds\_3WayHt;
use App\Console\Commands\Grapper\TxOdds\Odds\_Dc;
use App\Console\Commands\Grapper\TxOdds\Odds\_Dnb;
use App\Console\Commands\Grapper\TxOdds\Odds\_Ggng;
use App\Console\Commands\Grapper\TxOdds\Odds\_Points;
use App\Console\Commands\Grapper\TxOdds\Odds\_PointsHt;
use App\Console\Commands\Grapper\TxOdds\Odds\_PointsQ1;
use App\Console\Commands\Grapper\TxOdds\Odds\_Totals;
use App\Console\Commands\Grapper\TxOdds\Odds\_TotalsHt;
use App\Console\Commands\Grapper\TxOdds\Odds\_TotalsQ1;
use App\Console\Commands\Grapper\TxOdds\Odds\_Tq;
use App\Console\Commands\Grapper\TxOdds\Odds\WorkCollector;
use App\Console\Commands\Nuh;
use App\Console\Commands\Xml;
use App\Models\CompetitionGroup;
@@ -191,7 +195,8 @@ class Odds
/**
* TODAY
*/
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->pluck('id');
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&peid=".$id;
}
@@ -202,7 +207,7 @@ class Odds
/**
* ONE WEEK
*/
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id');
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
@@ -275,6 +280,8 @@ class Odds
];
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
Nuh::$collector = [];
foreach ($row->bookmaker as $book) {
Nuh::$id = (int) $row['id'];
@@ -283,7 +290,6 @@ class Odds
$odds = [];
$odds['sport_id'] = (int) $event['sport_id'];
$odds['flag'] = 1;
$odds['provider_id'] = Nuh::$options['provider_id'];
$odds['nuh_check'] = 0;
@@ -302,6 +308,9 @@ class Odds
case 'bmoid':
$odds['bmoid'] = (string) $attributeValue;
break;
case 'flag':
$odds['flag'] = (string) $attributeValue;
break;
}
}
@@ -334,10 +343,10 @@ class Odds
break;
case 131075:
_PointsQt::grap($odds, $offer);
_PointsQ1::grap($odds, $offer);
break;
case 131076:
_TotalsQt::grap($odds, $offer);
_TotalsQ1::grap($odds, $offer);
break;
case 5242880:
@@ -359,6 +368,7 @@ class Odds
}
}
}
WorkCollector::run();
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
class FillCollector
{
public static function set($odds, $bettype)
{
if (! isset(Nuh::$collector[$bettype][Nuh::$bookmaker_id]['difference'])) {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['difference'] = $odds['difference'];
if (isset($odds['handicap'])) {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['active_spread'] = $odds['handicap'];
} else {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['active_spread'] = $odds['total'];
}
} elseif ($odds['difference'] < Nuh::$collector[$bettype][Nuh::$bookmaker_id]['difference']) {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['difference'] = $odds['difference'];
if (isset($odds['handicap'])) {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['active_spread'] = $odds['handicap'];
} else {
Nuh::$collector[$bettype][Nuh::$bookmaker_id]['active_spread'] = $odds['total'];
}
}
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use Illuminate\Support\Facades\DB;
class WorkCollector
{
public static function run()
{
foreach (Nuh::$collector as $table => $value) {
DB::table($table)->where('event_id', Nuh::$id)->where('provider_id', Nuh::$options['provider_id'])->update(['active_spread' => 0]);
}
foreach (Nuh::$collector as $table => $bookmaker) {
foreach ($bookmaker as $bookmaker_id => $values) {
if (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
DB::table($table)
->where('event_id', Nuh::$id)
->where('bookmaker_id', $bookmaker_id)
->where('handicap', $values['active_spread'])
->update(['active_spread' => 1]);
} else {
DB::table($table)
->where('event_id', Nuh::$id)
->where('bookmaker_id', $bookmaker_id)
->where('total', $values['active_spread'])
->update(['active_spread' => 1]);
}
}
}
}
}
@@ -3,8 +3,8 @@
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 _2Way
{
@@ -17,7 +17,7 @@ class _2Way
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
Odds2way::updateOrCreate([
DB::table('odds_2ways')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
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 _2WayS1
{
@@ -17,7 +17,7 @@ class _2WayS1
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
Odds2wayS1::updateOrCreate([
DB::table('odds_2ways_s1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
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 _3Way
{
@@ -18,7 +18,7 @@ class _3Way
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
Odds3way::updateOrCreate([
DB::table('odds_3ways')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _3WayHt
{
@@ -13,11 +14,10 @@ class _3WayHt
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
$odds['starttime'] = (string) $value['starttime'];
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
Odds3wayHt::updateOrCreate([
DB::table('odds_3ways_ht')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
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 _Dc
{
@@ -17,7 +17,7 @@ class _Dc
}
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dcx2']], 1);
OddsDc::updateOrCreate([
DB::table('odds_dc')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
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 _Dnb
{
@@ -16,7 +16,7 @@ class _Dnb
}
$odds['margin'] = (float) Margin::calculate([$odds['dnb1'], $odds['dnb2']], 1);
OddsDnb::updateOrCreate([
DB::table('odds_dnb')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
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 _Ggng
{
@@ -16,7 +16,7 @@ class _Ggng
}
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
OddsGgng::updateOrCreate([
DB::table('odds_ggng')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsPoint;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _Points
{
@@ -16,10 +16,16 @@ class _Points
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
OddsPoint::updateOrCreate([
FillCollector::set($odds, 'odds_points');
DB::table('odds_points')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsPointHt;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _PointsHt
{
@@ -16,10 +16,16 @@ class _PointsHt
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
OddsPointHt::updateOrCreate([
FillCollector::set($odds, 'odds_points_ht');
DB::table('odds_points_ht')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsPointQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _PointsQ1
{
@@ -16,10 +16,16 @@ class _PointsQ1
$odds['handicap'] = (float) $value->o3;
}
if (fmod((float) $odds['handicap'], 1) != 0.5) {
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
OddsPointQ1::updateOrCreate([
FillCollector::set($odds, 'odds_points_q1');
DB::table('odds_points_q1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _Totals
{
@@ -20,12 +20,18 @@ class _Totals
if ((float) $odds['total'] != 2.5) {
return;
}
} else {
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
}
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
OddsTotal::updateOrCreate([
FillCollector::set($odds, 'odds_totals');
DB::table('odds_totals')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'total' => $odds['total'],
@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _TotalsHt
{
@@ -15,10 +16,16 @@ class _TotalsHt
$odds['total'] = (float) $value->o3;
}
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
OddsTotalHt::updateOrCreate([
FillCollector::set($odds, 'odds_totals_ht');
DB::table('odds_totals_ht')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'total' => $odds['total'],
@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsTotalQ1;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _TotalsQ1
{
@@ -16,10 +16,16 @@ class _TotalsQ1
$odds['total'] = (float) $value->o3;
}
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
OddsTotalQ1::updateOrCreate([
FillCollector::set($odds, 'odds_totals_q1');
DB::table('odds_totals_q1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'total' => $odds['total'],
@@ -3,8 +3,8 @@
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 _Tq
{
@@ -16,7 +16,7 @@ class _Tq
}
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
OddsTq::updateOrCreate([
DB::table('odds_tq')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
+2
View File
@@ -20,6 +20,8 @@ class Nuh extends Command
public static $bookmaker_id;
public static $collector = [];
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--b} {--w} {--g} {--r} {--s} {--t}';