stuck with livewire

This commit is contained in:
salam committed 2026-01-11 09:09:16 +01:00
1 parent b21cdb507a
commit c0f2689ff6
30 files changed
+372 -64

No files matched your search

@@ -1,13 +1,32 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds\Odds;
namespace App\Console\Commands\Grapper\Helper;
use App\Console\Commands\Nuh;
use Illuminate\Support\Facades\DB;
class WorkCollector
class ActiveSpread
{
public static function run()
public static function collect($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'];
}
}
}
public static function set()
{
foreach (Nuh::$collector as $table => $value) {
@@ -0,0 +1,60 @@
<?php
namespace App\Console\Commands\Grapper\Helper;
use App\Console\Commands\Nuh;
use App\Models\BookmakerSport;
class BookmakerOffer
{
/**
* bookmaker overview, what we have from witch povider from what sport
*
* @var array
*/
public static $collector = [];
public static function init()
{
$debug = Nuh::$options['d'] ?? 0;
if (Nuh::$options['d'] == 'bkms') {
self::$collector = [];
}
}
public static function collect($bookmaker_id, $sport_id)
{
if (Nuh::$options['d'] == 'bkms') {
if (! isset(self::$collector[$sport_id])) {
self::$collector[$sport_id] = [];
}
if (! in_array($bookmaker_id, self::$collector[$sport_id])) {
self::$collector[$sport_id][] = $bookmaker_id;
}
}
}
public static function finalize()
{
if (Nuh::$options['d'] == 'bkms') {
foreach (self::$collector as $sport_id => $bookmaker_ids) {
BookmakerSport::where('provider_id', Nuh::$options['provider_id'])
->where('sport_id', (int) $sport_id)
->update(['is_active' => 0]);
foreach ($bookmaker_ids as $bookmaker_id) {
BookmakerSport::updateOrCreate([
'provider_id' => Nuh::$options['provider_id'],
'bookmaker_id' => (int) $bookmaker_id,
'sport_id' => (int) $sport_id,
], [
'is_active' => 1,
]);
}
}
}
}
}
+18 -9
View File
@@ -2,6 +2,8 @@
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Grapper\Helper\BookmakerOffer;
use App\Console\Commands\Grapper\TxOdds\Odds\_2Way;
use App\Console\Commands\Grapper\TxOdds\Odds\_2WayS1;
use App\Console\Commands\Grapper\TxOdds\Odds\_3Way;
@@ -16,7 +18,6 @@ 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;
@@ -37,6 +38,7 @@ class Odds
Notice::note('txodd odd sport: '.Nuh::$options['sport_id'], 'b');
}
BookmakerOffer::init();
/**
* Delete
*/
@@ -159,7 +161,7 @@ class Odds
$_calls = [];
if (Nuh::$options['id']) {
if ($debug) {
Notice::note('BY ID', 'p');
Notice::note("BY ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* by SINGLE ID
@@ -167,7 +169,7 @@ class Odds
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['id'];
} elseif (Nuh::$options['a']) {
if ($debug) {
Notice::note('ALL', 'p');
Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* ALL by ID
@@ -178,7 +180,7 @@ class Odds
}
} elseif (Nuh::$options['g']) {
if ($debug) {
Notice::note('PER GROUP_ID', 'p');
Notice::note("GROUP_ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* PER GROUP_ID
@@ -190,19 +192,22 @@ class Odds
}
} elseif (Nuh::$options['t']) {
if ($debug) {
Notice::note('TODAY', 'p');
Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* TODAY
*/
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->pluck('id');
$from = Carbon::now()->toDateTimeString();
$to = Carbon::now()->addDays(1)->toDateTimeString();
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', $from)->where('starttime', '<', $to)->pluck('id');
foreach ($res as $id) {
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&peid=".$id;
}
} elseif (Nuh::$options['w']) {
if ($debug) {
Notice::note('ONE WEEK FROM NOW', 'p');
Notice::note("WEEK \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* ONE WEEK
@@ -213,7 +218,7 @@ class Odds
}
} else {
if ($debug) {
Notice::note('WITH LASTCALL Parameter', 'p');
Notice::note("LASTCALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
}
/**
* WITH LASTCALL Parameter
@@ -293,6 +298,8 @@ class Odds
$odds['provider_id'] = Nuh::$options['provider_id'];
$odds['nuh_check'] = 0;
BookmakerOffer::collect($book['bid'], $event['sport_id']);
foreach ($book->offer as $offer) {
$bettypeid = 0;
@@ -368,10 +375,12 @@ class Odds
}
}
}
WorkCollector::run();
ActiveSpread::set();
}
}
BookmakerOffer::finalize();
if ($debug) {
Notice::note('DONE - EVENTS: '.$counter, 'g');
}
@@ -1,27 +0,0 @@
<?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'];
}
}
}
}
@@ -13,7 +13,6 @@ class _2WayS1
foreach ($offer as $value) {
$odds['h2w'] = (float) $value->o1;
$odds['a2w'] = (float) $value->o3;
$odds['starttime'] = (string) $value['starttime'];
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -23,7 +24,7 @@ class _Points
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
FillCollector::set($odds, 'odds_points');
ActiveSpread::collect($odds, 'odds_points');
DB::table('odds_points')->updateOrInsert([
'event_id' => Nuh::$id,
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -23,7 +24,7 @@ class _PointsHt
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
FillCollector::set($odds, 'odds_points_ht');
ActiveSpread::collect($odds, 'odds_points_ht');
DB::table('odds_points_ht')->updateOrInsert([
'event_id' => Nuh::$id,
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -23,7 +24,7 @@ class _PointsQ1
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
FillCollector::set($odds, 'odds_points_q1');
ActiveSpread::collect($odds, 'odds_points_q1');
DB::table('odds_points_q1')->updateOrInsert([
'event_id' => Nuh::$id,
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -29,7 +30,7 @@ class _Totals
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
FillCollector::set($odds, 'odds_totals');
ActiveSpread::collect($odds, 'odds_totals');
DB::table('odds_totals')->updateOrInsert([
'event_id' => Nuh::$id,
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -23,7 +24,7 @@ class _TotalsHt
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
FillCollector::set($odds, 'odds_totals_ht');
ActiveSpread::collect($odds, 'odds_totals_ht');
DB::table('odds_totals_ht')->updateOrInsert([
'event_id' => Nuh::$id,
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\Helper\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -23,7 +24,7 @@ class _TotalsQ1
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
FillCollector::set($odds, 'odds_totals_q1');
ActiveSpread::collect($odds, 'odds_totals_q1');
DB::table('odds_totals_q1')->updateOrInsert([
'event_id' => Nuh::$id,
+10 -10
View File
@@ -24,7 +24,7 @@ class Nuh extends Command
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--b} {--w} {--g} {--r} {--s} {--t} {--x}';
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--x} {--t} {--w} {--g} {--r} {--s} {--t} {--q}';
protected $description = 'Nuh';
@@ -37,28 +37,28 @@ class Nuh extends Command
if ($this->argument('process') == 'help') {
$txt = PHP_EOL;
$txt .= 'List of parameters'.PHP_EOL;
$txt .= 'Parameters'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'process [id] (required)'.PHP_EOL;
$txt .= '--id=matchid (optional) calling spezific id'.PHP_EOL;
$txt .= '--func=name (optional) start special function in code'.PHP_EOL;
$txt .= '--f=name (optional) [bookmaker_sport]'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
$txt .= 'List of options'.PHP_EOL;
$txt .= 'Options'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--p use proxy'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--x supervisors'.PHP_EOL;
$txt .= '--b load one day single '.PHP_EOL;
$txt .= '--w laod one week (tx)'.PHP_EOL;
$txt .= '--x generate supervisors'.PHP_EOL;
$txt .= '--t load today'.PHP_EOL;
$txt .= '--w laod this week (tx)'.PHP_EOL;
$txt .= '--g by minor groups (tx)'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--r read data from file '.PHP_EOL;
$txt .= '--s store data to file '.PHP_EOL;
$txt .= '--t test server url '.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--q print all queries'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
$txt .= 'List of supervisors'.PHP_EOL;
$txt .= 'Supervisors'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$tmp = Supervisor::orderBy('provider_id')->get();
foreach ($tmp as $value) {