This commit is contained in:
salam committed 2026-01-08 12:51:12 +01:00
1 parent fa0e2cdef1
commit 4f9125ef12
13 files changed
+100 -64

No files matched your search

@@ -20,7 +20,7 @@ class Bet365
{
$debug = Nuh::$options['d'] ?? 0;
$break = Nuh::$options['b'] ?? 0;
$today = Nuh::$options['t'] ?? 0;
$week = Nuh::$options['w'] ?? 0;
@@ -29,7 +29,7 @@ class Bet365
*/
$bookmaker_id = 126;
if ($break) {
if ($today) {
$events = Event::where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDay()->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
} elseif ($week) {
$events = Event::where('bet365_id', '>', 0)->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
@@ -23,7 +23,7 @@ class Fixtures
{
$debug = Nuh::$options['d'] ?? 0;
$break = Nuh::$options['b'] ?? 0;
$today = Nuh::$options['t'] ?? 0;
/**
* Delete Started
@@ -108,7 +108,7 @@ class Fixtures
}
}
if ($break) {
if ($today) {
break;
}
}
@@ -3,14 +3,12 @@
namespace App\Console\Commands\Grapper\Logifuture;
use App\Console\Commands\Nuh;
use App\Console\Commands\Grapper\Logifuture\Auth;
class BaseUrl
{
public static function get()
{
$test = Nuh::$options['t'] ?? 0;
$test = false;
switch (Nuh::$options['provider_id']) {
case 5:
if ($test) {
@@ -9,7 +9,7 @@ class BaseUrl
{
public static function get()
{
$test = Nuh::$options['t'] ?? 0;
$test = 0;
switch (Nuh::$options['provider_id']) {
case 3:
@@ -17,7 +17,7 @@ class Fixtures
{
$debug = Nuh::$options['d'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
$break = Nuh::$options['b'] ?? 0;
$break = Nuh::$options['t'] ?? 0;
$week = Nuh::$options['w'] ?? 0;
$count = 0;
@@ -38,7 +38,7 @@ class Fixtures
/**
* Grap
*/
for ($i = 0; $i < 30; $i++) {
for ($i = Nuh::$options['days_from']; $i < Nuh::$options['days_to']; $i++) {
$url = 'https://xml2.txodds.com/feed/result/xml.php?'.Nuh::$AUTHTOKEN.'&date='.$now->toDateString().','.$now->addDays(1)->toDateString();
+47 -16
View File
@@ -88,7 +88,6 @@ class Odds
*************************************************/
$debug = Nuh::$options['d'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
switch (Nuh::$options['sport_id']) {
case 1:
@@ -118,38 +117,74 @@ class Odds
*************************************************/
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&spid='.Nuh::$options['sport_id'];
$_calls = [];
if (Nuh::$options['event_id']) {
// by id
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['event_id'];
if (Nuh::$options['id']) {
if ($debug) {
Notice::note('BY ID', 'p');
}
/**
* BY ID
*/
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['id'];
} elseif (Nuh::$options['a']) {
// all existing
if ($debug) {
Notice::note('ALL EXISTING', 'p');
}
/**
* ALL EXISTING
*/
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} elseif (Nuh::$options['g']) {
// one week per group names (mybee fastes)
if ($debug) {
Notice::note('PER GROUP_ID', 'p');
}
/**
* PER GROUP_ID
*
* with from-to days
*/
$groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id');
foreach ($groupids as $groupid) {
$_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days=0,1&pgid='.$groupid;
$_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&pgid='.$groupid;
}
} elseif (Nuh::$options['b']) {
// one day
} elseif (Nuh::$options['t']) {
if ($debug) {
Notice::note('TODAY', 'p');
}
/**
* TODAY
*/
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} elseif (Nuh::$options['w']) {
// one week
if ($debug) {
Notice::note('ONE WEEK FROM NOW', 'p');
}
/**
* ONE WEEK
*/
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id');
foreach ($res as $id) {
$_calls[] = $url."&ot=$markets&peid=".$id;
}
} else {
// all with lastcall
$_calls[] = $url."&ot=$markets&last=".Nuh::$options['lastcall'];
if ($debug) {
Notice::note('WITH LASTCALL Parameter', 'p');
}
/**
* WITH LASTCALL Parameter
* with from-to days
*/
$_calls[] = $url."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&last='.Nuh::$options['lastcall'];
}
dd($_calls);
/*************************************************
* CALL
*************************************************/
@@ -160,10 +195,6 @@ class Odds
$data = Xml::load($url);
if ($echo) {
dd($data);
}
if ($debug) {
Notice::note('counter: '.count($_calls).'/'.$counter, 'g');
}
+6 -9
View File
@@ -24,7 +24,7 @@ class Nuh extends Command
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--w} {--p} {--e} {--s} {--r} {--b} {--q} {--t} {--g}';
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--b} {--w} {--g} {--r} {--s} {--t}';
protected $description = 'Nuh';
@@ -32,7 +32,6 @@ class Nuh extends Command
{
self::$options = $this->options();
self::$options['supervisor_id'] = $this->argument('process');
self::$options['event_id'] = $this->argument('eventid');
$queries = self::$options['q'] ?? 0;
@@ -41,23 +40,21 @@ class Nuh extends Command
$txt .= 'List of parameters'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'process [id] (required)'.PHP_EOL;
$txt .= 'eventid [id] (optional)'.PHP_EOL;
$txt .= '--id=matchid (optional) calling spezific id'.PHP_EOL;
$txt .= '--func=name (optional) start special function in code'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
$txt .= 'List of options'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--p use proxy'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--b load one day single '.PHP_EOL;
$txt .= '--w laod one week (tx)'.PHP_EOL;
$txt .= '--g by minor groups (tx)'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--e echo file'.PHP_EOL;
$txt .= '--f force update market'.PHP_EOL;
$txt .= '--p use proxy'.PHP_EOL;
$txt .= '--q print queries'.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;
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Supervisors\Schemas;
use App\Models\Sport;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class SupervisorForm
@@ -26,9 +27,14 @@ class SupervisorForm
})
->nullable(),
TextInput::make('grap_days_pattern'),
TextInput::make('sleep')->default(15),
TextInput::make('maxsconds')->label('Seconds till throwing an error')->default(1800),
Section::make('Run processes paralell for speed')
->description('Set start and end days if more processes grap the same data')
->schema([
TextInput::make('days_from')->columns(1),
TextInput::make('days_to')->columns(1),
])->columns(2)->columnSpanFull(),
]);
}
}
@@ -8,7 +8,6 @@ use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\SelectColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
@@ -38,13 +37,12 @@ class SupervisorsTable
'Betfair' => 'Betfair',
]),
TextColumn::make('sport.name')->label('Sport')->color(fn ($record): string => $record->sport->color),
TextInputColumn::make('days_from')->width('1rem')
->extraAttributes(['class' => 'small-text-input-column']),
TextInputColumn::make('days_to')->width('1rem'),
TextColumn::make('days_from')->label('From'),
TextColumn::make('days_to')->label('To'),
TextColumn::make('sleep')->numeric(),
TextColumn::make('runtime')->label('Run Time'),
TextColumn::make('maxsconds')->label('Max Time'),
IconColumn::make('is_cron')->boolean()->label('Cron'),
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
ToggleColumn::make('is_active')->label('Active'),
])
->filters([
+2 -1
View File
@@ -17,7 +17,8 @@ class Supervisor extends Model
'lastcall',
'is_cron',
'is_active',
'grap_days_pattern',
'days_from',
'days_to',
];
protected $casts = [
+3 -1
View File
@@ -29,7 +29,9 @@ class Supervisorctl
Notice::note('supervisor start '.self::$code, 'g');
}
$options = array_merge($options, $supervisor->toArray());
$tmp = $supervisor->toArray();
unset($tmp['id']);
$options = array_merge($options, $tmp);
if ($proxy) {
$options['proxy'] = 'https://prox2.nuhodds.com/proxy.php';
}
@@ -26,7 +26,10 @@ return new class extends Migration
$table->boolean('is_cron')->default(0);
$table->boolean('is_active')->default(0);
$table->string('grap_days_pattern')->nullable();
$table->integer('days_from')->default(10);
$table->integer('days_to')->default(10);
$table->timestamps();
});
}
+20 -20
View File
@@ -12,27 +12,27 @@ class SupervisorSeeder extends Seeder
/**
* Supervisor
*/
$sql = "INSERT INTO `supervisors` (`id`, `name`, `provider_id`, `sport_id`, `sleep`, `limit`, `runtime`, `maxsconds`, `lastcall`, `is_cron`, `is_active`, `created_at`, `updated_at`)
$sql = "INSERT INTO `supervisors` (`id`, `name`, `provider_id`, `sport_id`, `sleep`, `limit`, `runtime`, `maxsconds`, `lastcall`, `is_cron`, `is_active`, `days_from`, `days_to`, `created_at`, `updated_at`)
VALUES
(1, 'Fixtures', 1, 1, 10, 0, '0.073', 1800, 0, 1, 1, '2025-08-27 07:39:55', '2026-01-04 10:09:15'),
(2, 'Odds', 1, 1, 10, 0, '0.251', 30, 0, 0, 1, '2025-12-01 05:41:02', '2025-12-22 05:20:40'),
(3, 'Fixtures', 2, 0, 15, 0, '0.133', 1800, 0, 1, 1, '2025-12-19 11:42:35', '2026-01-04 10:25:00'),
(4, 'Willhill', 2, 0, 15, 0, '2.119', 1800, 0, 1, 1, '2025-12-19 11:48:05', '2026-01-04 10:27:11'),
(5, 'Bwin', 2, 0, 15, 0, '0.084', 1800, 0, 1, 1, '2025-12-22 06:41:18', '2026-01-04 10:29:32'),
(6, 'Bet365', 2, 0, 10, 0, '0', 30, 0, 0, 1, '2025-12-18 17:44:33', '2026-01-01 17:09:28'),
(7, 'Betfair', 2, 0, 10, 0, '0', 30, 0, 0, 0, '2025-12-18 17:44:33', '2026-01-03 12:28:09'),
(8, 'Fixtures', 4, 0, 10, 0, '1.368', 30, 0, 1, 1, '2025-12-18 17:44:33', '2026-01-03 12:24:52'),
(9, 'Odds', 4, 0, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(10, 'Fixtures', 3, 0, 10, 0, '1.368', 30, 0, 1, 1, '2025-12-18 17:44:33', '2026-01-03 12:24:52'),
(11, 'Odds', 3, 0, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(12, 'Odds', 5, 1, 10, 0, '1.368', 30, 0, 0, 1, '2025-12-18 17:44:33', '2026-01-05 06:22:27'),
(13, 'Odds', 5, 3, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-05 06:22:37'),
(14, 'Odds', 5, 2, 10, 0, '1.368', 30, 0, 0, 1, '2025-12-18 17:44:33', '2026-01-05 06:22:51'),
(15, 'Odds', 5, 5, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(16, 'Odds', 6, 1, 10, 0, '1.368', 30, 0, 0, 1, '2025-12-18 17:44:33', '2026-01-05 06:22:27'),
(17, 'Odds', 6, 3, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-05 06:22:37'),
(18, 'Odds', 6, 2, 10, 0, '1.368', 30, 0, 0, 1, '2025-12-18 17:44:33', '2026-01-05 06:22:51'),
(19, 'Odds', 6, 5, 15, 0, NULL, 1800, 0, 0, 1, '2026-01-03 12:27:44', '2026-01-03 12:27:53');
(1, 'Fixtures', 1, 1, 10, 0, '0.073', 1800, 0, 1, 1, 0, 0, '2025-08-27 07:39:55', '2026-01-08 10:23:28'),
(2, 'Odds', 1, 1, 10, 0, '0.251', 30, 0, 0, 1, 0, 0, '2025-12-01 05:41:02', '2025-12-22 05:20:40'),
(3, 'Fixtures', 2, 0, 15, 0, '0.133', 1800, 0, 1, 1, 0, 0, '2025-12-19 11:42:35', '2026-01-08 10:25:32'),
(4, 'Willhill', 2, 0, 15, 0, '2.119', 1800, 0, 1, 1, 0, 0, '2025-12-19 11:48:05', '2026-01-04 10:27:11'),
(5, 'Bwin', 2, 0, 15, 0, '0.084', 1800, 0, 1, 1, 0, 0, '2025-12-22 06:41:18', '2026-01-04 10:29:32'),
(6, 'Bet365', 2, 0, 10, 0, '0', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-01 17:09:28'),
(7, 'Betfair', 2, 0, 10, 0, '0', 30, 0, 0, 0, 0, 0, '2025-12-18 17:44:33', '2026-01-03 12:28:09'),
(8, 'Fixtures', 4, 0, 10, 0, '1.368', 30, 0, 1, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-03 12:24:52'),
(9, 'Odds', 4, 0, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(10, 'Fixtures', 3, 0, 10, 0, '1.368', 30, 0, 1, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-03 12:24:52'),
(11, 'Odds', 3, 0, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(12, 'Odds', 5, 1, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:27'),
(13, 'Odds', 5, 3, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-05 06:22:37'),
(14, 'Odds', 5, 2, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:51'),
(15, 'Odds', 5, 5, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53'),
(16, 'Odds', 6, 1, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:27'),
(17, 'Odds', 6, 3, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-05 06:22:37'),
(18, 'Odds', 6, 2, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:51'),
(19, 'Odds', 6, 5, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53');
";
DB::unprepared($sql);
}