remove lucide
This commit is contained in:
1 parent
d2caac4bcc
commit
208ef96178
46 files changed
+174
-337
No files matched your search
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\ClientBookmaker;
|
||||
use App\Models\Provider;
|
||||
use App\Models\Sport;
|
||||
use App\Models\Supervisor;
|
||||
|
||||
class SupervisorDb
|
||||
{
|
||||
public static function generate($command)
|
||||
{
|
||||
return;
|
||||
$_client_bookmaker = ClientBookmaker::get()->all();
|
||||
$_provider = Provider::get()->all();
|
||||
$_sports = Sport::where('is_active', 1)->get()->all();
|
||||
$_bookmaker = Bookmaker::where('is_active', 1)->get()->all();
|
||||
|
||||
$processes = Supervisor::where('command', $command)->get()->all();
|
||||
|
||||
$have = [];
|
||||
foreach ($processes as $process) {
|
||||
|
||||
dd($process);
|
||||
|
||||
$have[] = $process['code'];
|
||||
|
||||
$tmp = [];
|
||||
$tmp['process'] = $process->command;
|
||||
|
||||
if (! $process->per_sport && ! $process->per_client) {
|
||||
// $tmp['code'] = $row->command.$row->process;
|
||||
// $tmp['command'] = $row->command.' '.$row->process;
|
||||
// $tmp['description'] = $row->description;
|
||||
// $res = Supervisor::where('code', $tmp['code'])->get();
|
||||
// if (! $res->count()) {
|
||||
// Supervisor::insert($tmp);
|
||||
// }
|
||||
|
||||
} elseif ($process->per_sport && ! $process->per_client) {
|
||||
foreach ($sports as $sport) {
|
||||
$tmp['command'] = $process->process.$sport->code;
|
||||
$tmp['sport_id'] = $sport->id;
|
||||
$tmp['description'] = $process->description.' '.$sport->sport;
|
||||
Supervisor::updateOrCreate(
|
||||
['code' => $process->command.$sport->code, 'sport_id' => $sport->id],
|
||||
['command' => $process->process.$sport->code, 'description' => $process->description]
|
||||
);
|
||||
}
|
||||
|
||||
// } elseif (! $row->per_sport && $row->per_client) {
|
||||
// foreach ($clients as $client) {
|
||||
|
||||
// $tmp['customer_id'] = $client->id;
|
||||
// if ($row->command == 'sen') {
|
||||
// $tmp['code'] = $row->command.$row->process.$client->id;
|
||||
// $tmp['command'] = $row->command.' '.$row->process.' '.$client->id;
|
||||
// } else {
|
||||
// $tmp['code'] = $row->command.$client->id;
|
||||
// $tmp['command'] = $row->command.' '.$client->id;
|
||||
// }
|
||||
// $tmp['description'] = $row->description.' '.$client->customer;
|
||||
// $res = Supervisor::where('code', $tmp['code'])->get();
|
||||
// if (! $res->count()) {
|
||||
// Supervisor::insert($tmp);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// foreach ($sports as $sport) {
|
||||
// foreach ($clients as $client) {
|
||||
// $tmp['sport_id'] = $sport->id;
|
||||
// $tmp['customer_id'] = $client->id;
|
||||
// $tmp['code'] = $row->command.$sport->code.$client->id;
|
||||
// $tmp['command'] = $row->command.' '.$sport->code.' '.$client->id;
|
||||
// $tmp['description'] = $row->description.' '.$client->customer.' '.$sport->sport;
|
||||
// $res = Supervisor::where('code', $tmp['code'])->get();
|
||||
// if (! $res->count()) {
|
||||
// Supervisor::insert($tmp);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
Supervisor::where('process', $command)->whereNotIn('code', $have)->delete();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\Supervisor;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class SupervisorMaker
|
||||
{
|
||||
@@ -10,66 +11,55 @@ class SupervisorMaker
|
||||
|
||||
public static $path = '';
|
||||
|
||||
public static function run()
|
||||
public static function run($supervisor)
|
||||
{
|
||||
self::$base = base_path().DIRECTORY_SEPARATOR.'supervisor'.DIRECTORY_SEPARATOR;
|
||||
$supervisors = Supervisor::get();
|
||||
|
||||
$sup = Supervisor::with('option')
|
||||
->with('sport')
|
||||
->with('provider')
|
||||
->with('client')
|
||||
->with('bookmaker')
|
||||
->get()->all();
|
||||
foreach ($supervisors as $supervisor) {
|
||||
|
||||
foreach ($sup as $row) {
|
||||
$dirname = self::fix_string($supervisor->provider->name);
|
||||
|
||||
$process = $row->command;
|
||||
if ($row->option) {
|
||||
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->option->name));
|
||||
}
|
||||
if ($row->provider) {
|
||||
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->provider->name));
|
||||
}
|
||||
if ($row->sport) {
|
||||
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->sport->name));
|
||||
}
|
||||
if ($row->client) {
|
||||
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->client->name));
|
||||
}
|
||||
if ($row->bookmaker) {
|
||||
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->bookmaker->name));
|
||||
$path = base_path().'/supervisor/'.strtolower($dirname);
|
||||
|
||||
if (! is_dir($path)) {
|
||||
mkdir($path, 0777);
|
||||
}
|
||||
|
||||
if (! is_dir(self::$base.$row->command)) {
|
||||
mkdir(self::$base.$row->command, 0777, true);
|
||||
$sport = self::fix_string($supervisor->sport?->name) ?? 'all';
|
||||
$process = 'p'.$supervisor->id.'_'.self::fix_string($supervisor->name).'_'.$sport;
|
||||
if ($supervisor->days_to) {
|
||||
$process .= '_'.$supervisor->days_from;
|
||||
$process .= '_'.$supervisor->days_to;
|
||||
}
|
||||
|
||||
self::$path = self::$base.$row->command.DIRECTORY_SEPARATOR;
|
||||
$content = '[program:'.$process.']'.PHP_EOL;
|
||||
$content .= 'command=/usr/bin/php '.base_path().'/artisan nuh '.$supervisor->id.PHP_EOL;
|
||||
$content .= 'autostart=true'.PHP_EOL;
|
||||
$content .= 'autorestart=true'.PHP_EOL;
|
||||
|
||||
self::create_single($process, $row->is_active, $row->is_cron, $row->command, $row->id);
|
||||
$file = $path.'/'.$process.'.ini';
|
||||
if ($supervisor->is_active && ! $supervisor->is_cron) {
|
||||
file_put_contents($file, $content);
|
||||
chmod($file, 0777);
|
||||
} else {
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config('env.app_env') == 'production') {
|
||||
$exec = base_path().'/super_update.sh';
|
||||
$exec = base_path().'/supervisor/super_update.sh';
|
||||
exec($exec, $out, $rcode);
|
||||
}
|
||||
|
||||
Notice::note('SUPERVISOR '.\count($supervisors).' PROCESSES UPDATED', 'b', 1);
|
||||
}
|
||||
|
||||
public static function create_single($process, $is_active, $is_cron, $command, $id)
|
||||
public static function fix_string($string)
|
||||
{
|
||||
$file = self::$path.$process.'.ini';
|
||||
$content = '[program:'.$process.']'.PHP_EOL;
|
||||
$content .= 'command=/usr/bin/php '.base_path().'/artisan '.$command.' '.$id.PHP_EOL;
|
||||
$content .= 'autostart=true'.PHP_EOL;
|
||||
$content .= 'autorestart=true'.PHP_EOL;
|
||||
$string = preg_replace("'\W'", '_', $string);
|
||||
|
||||
if ($is_active && ! $is_cron) {
|
||||
file_put_contents($file, $content);
|
||||
chmod($file, 0777);
|
||||
} else {
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
return strtolower($string);
|
||||
}
|
||||
}
|
||||
@@ -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}';
|
||||
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--b} {--w} {--g} {--r} {--s} {--t} {--x}';
|
||||
|
||||
protected $description = 'Nuh';
|
||||
|
||||
@@ -48,12 +48,11 @@ class Nuh extends Command
|
||||
$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 .= '--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;
|
||||
@@ -78,10 +77,6 @@ class Nuh extends Command
|
||||
|
||||
Supervisorctl::start(self::$options);
|
||||
|
||||
if (! self::$options['is_active']) {
|
||||
Notice::note('Process disabled', 'r', 1);
|
||||
}
|
||||
|
||||
switch (self::$options['provider_id']) {
|
||||
case 1:
|
||||
TxOdds::switch();
|
||||
|
||||
@@ -7,7 +7,7 @@ use Filament\Clusters\Cluster;
|
||||
|
||||
class AdministratorCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-user';
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-atom';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
}
|
||||
@@ -10,14 +10,13 @@ use App\Models\Bettype;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BettypeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bettype::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::AdjustmentsHorizontal;
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-sliders';
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class BookmakerResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-notebook-pen';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-bookmarks-simple';
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-flag';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-flag';
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
|
||||
@@ -317,12 +317,11 @@ class EventsTable
|
||||
Action::make('txodds_odds')
|
||||
->label('TxOdds')
|
||||
->disabled(fn () => ! auth()->user()->hasRole('super_admin'))
|
||||
->icon('heroicon-o-arrow-top-right-on-square')
|
||||
->icon('phosphor-arrow-square-out')
|
||||
->url(fn ($record): string => route('txodds_odds', ['sportid' => $record->sport_id, 'txoddsid' => $record->id]))
|
||||
->openUrlInNewTab(),
|
||||
])->iconButton()
|
||||
->icon('heroicon-m-ellipsis-vertical')
|
||||
->color('primary'),
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
||||
|
||||
@@ -19,7 +19,7 @@ class ProviderResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 23;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-arrow-down-up';
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-books';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class SportResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 24;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-volleyball';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-volleyball';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class SupervisorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Supervisor::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-sliders-vertical';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-network';
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SupervisorsTable
|
||||
@@ -41,8 +42,9 @@ class SupervisorsTable
|
||||
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')->falseColor('gray'),
|
||||
// TextColumn::make('maxsconds')->label('Max Time'),
|
||||
// IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
|
||||
ToggleColumn::make('is_cron')->label('Cron'),
|
||||
ToggleColumn::make('is_active')->label('Active'),
|
||||
])
|
||||
->filters([
|
||||
@@ -50,6 +52,8 @@ class SupervisorsTable
|
||||
->default(1)
|
||||
->relationship('provider', 'name')
|
||||
->label('Provider'),
|
||||
TernaryFilter::make('is_cron'),
|
||||
TernaryFilter::make('is_active'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
|
||||
@@ -17,7 +17,7 @@ class UserResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 31;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-user';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-user';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
'profile' => Action::make('profile')
|
||||
->label(fn () => Auth::user()->name)
|
||||
->url(fn (): string => EditProfilePage::getUrl())
|
||||
->icon('heroicon-m-user-circle'),
|
||||
->icon('phosphor-user-circle-fill'),
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
||||
->widgets([
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Utilities;
|
||||
|
||||
use App\Actions\SupervisorMaker;
|
||||
use App\Models\Supervisor;
|
||||
|
||||
class Supervisorctl
|
||||
@@ -14,6 +15,7 @@ class Supervisorctl
|
||||
{
|
||||
$debug = $options['d'] ?? 0;
|
||||
$proxy = $options['p'] ?? 0;
|
||||
$maker = $options['x'] ?? 0;
|
||||
|
||||
// sleep for 0,5 seconds
|
||||
usleep(500000);
|
||||
@@ -24,6 +26,10 @@ class Supervisorctl
|
||||
|
||||
$supervisor = Supervisor::with('sport')->with('provider')->find(self::$code);
|
||||
|
||||
if ($maker) {
|
||||
SupervisorMaker::run($supervisor);
|
||||
}
|
||||
|
||||
if ($supervisor) {
|
||||
if ($debug) {
|
||||
Notice::note('supervisor start '.self::$code, 'g');
|
||||
@@ -44,6 +50,12 @@ class Supervisorctl
|
||||
}
|
||||
}
|
||||
|
||||
if (! $options['is_active']) {
|
||||
Notice::note('Process disabled, sleeps 2 min then exit', 'r');
|
||||
sleep(120);
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
Notice::note('unknown supervisor: '.self::$code, 'r', 1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user