diff --git a/app/Console/Commands/Grapper/Sofascore.php b/app/Console/Commands/Grapper/Sofascore.php index 8e9203d3..ae665ab5 100644 --- a/app/Console/Commands/Grapper/Sofascore.php +++ b/app/Console/Commands/Grapper/Sofascore.php @@ -2,21 +2,21 @@ namespace App\Console\Commands\Grapper; -use App\Console\Commands\Grapper\Sofascore\Grapper; -use App\Console\Commands\Grapper\Sofascore\Helper\Strings; -use App\Console\Commands\Grapper\Sofascore\Helper\ZipFolder; -use App\Console\Commands\Grapper\Sofascore\MakeExcel; -use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason; -use App\Console\Commands\Grapper\Sofascore\Rose; -use App\Console\Commands\Grapper\Sofascore\SendMail; -use App\Console\Commands\Grapper\Sofascore\SettingsToLocal; -use App\Console\Commands\Grapper\Sofascore\SettingsToProduction; -use App\Console\Commands\Grapper\Sofascore\SqlMover; -use App\Console\Commands\Grapper\Sofascore\TournamentTeams; +use App\Utilities\Notice; use App\Console\Commands\Nuh; use App\Models\SofaScoreTask; -use App\Utilities\Notice; use Illuminate\Support\Carbon; +use App\Console\Commands\Grapper\Sofascore\Rose; +use App\Console\Commands\Grapper\Sofascore\Grapper; +use App\Console\Commands\Grapper\Sofascore\SendMail; +use App\Console\Commands\Grapper\Sofascore\SqlMover; +use App\Console\Commands\Grapper\Sofascore\MakeExcel; +use App\Console\Commands\Grapper\Sofascore\Helper\Strings; +use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason; +use App\Console\Commands\Grapper\Sofascore\SettingsToLocal; +use App\Console\Commands\Grapper\Sofascore\TournamentTeams; +use App\Console\Commands\Grapper\Sofascore\Helper\ZipFolder; +use App\Console\Commands\Grapper\Sofascore\SettingsToProduction; ini_set('magic_quotes_runtime', false); @@ -34,56 +34,55 @@ class Sofascore { $function = Nuh::$options['fun']; - switch ($function) { - case 1: + case 'player_season': PlayerPerSeason::run(); break; - case 2: + case 'set_to_local': SettingsToLocal::run(); break; - case 3: + case 'grapper': self::setStorage(); Grapper::load(); break; - case 4: + case 'zip': self::setStorage(); ZipFolder::create(); break; - case 5: + case 'mail': self::setStorage(); SendMail::run(); break; - case 6: + case 'rose': self::setStorage(); Rose::run(); break; - case 7: + case 'sql_mover': SqlMover::run(); break; - case 8: + case 'excel': self::setStorage(); MakeExcel::create(); break; - case 9: + case 'torunament_teams': TournamentTeams::get(); break; - case 10: + case 'set_to_production': SettingsToProduction::run(); break; default: - Notice::note('id not valid', 'br', 1); + Notice::note('not a valid fuction', 'br', 1); } } @@ -91,36 +90,39 @@ class Sofascore { $task = Nuh::$options['task']; $debug = Nuh::$options['d']; + $folder = Nuh::$options['folder']; $sofascore_data = storage_path('sofascore_data') . '/'; $task = SofaScoreTask::where('id', $task)->first(); - if (!$task) { - Notice::note("No SofaScoreTask " . Nuh::$options['task'], 'r', 1); - } - $storage_name = Strings::clean($task->name); + if ($task) { + $storage_name = Strings::clean($task->name); - switch ($task->id) { - case 1: - self::$storage = $sofascore_data . $storage_name; - self::$folder = Carbon::now()->subDays(3)->format('Y-m-d'); - break; - case 2: - self::$storage = $sofascore_data . $storage_name . '/' . $task->day_from; - self::$zipfile = $sofascore_data . $storage_name . '/' . $task->day_from . '.zip'; - break; - case 3: - self::$storage = $sofascore_data . $storage_name . '-' . $task->day_from . '-' . $task->day_to; - self::$zipfile = $sofascore_data . $storage_name . '-' . $task->day_from . '-' . $task->day_to . '.zip'; - break; - case 4: - self::$storage = $sofascore_data . $storage_name . '/rosa-' . Carbon::now()->format('Y-m-d'); - self::$zipfile = $sofascore_data . $storage_name . '/rosa-' . Carbon::now()->format('Y-m-d') . '.zip'; - break; + switch ($task->id) { + case 1: + self::$storage = $sofascore_data . $storage_name; + self::$folder = Carbon::now()->subDays(3)->format('Y-m-d'); + break; + case 2: + self::$storage = $sofascore_data . $storage_name . '/' . $task->day_from; + self::$zipfile = $sofascore_data . $storage_name . '/' . $task->day_from . '.zip'; + break; + case 3: + self::$storage = $sofascore_data . $storage_name . '-' . $task->day_from . '-' . $task->day_to; + self::$zipfile = $sofascore_data . $storage_name . '-' . $task->day_from . '-' . $task->day_to . '.zip'; + break; + case 4: + self::$storage = $sofascore_data . $storage_name . '/rosa-' . Carbon::now()->format('Y-m-d'); + self::$zipfile = $sofascore_data . $storage_name . '/rosa-' . Carbon::now()->format('Y-m-d') . '.zip'; + break; - default: - self::$storage = $sofascore_data . $storage_name; - self::$zipfile = $sofascore_data . $storage_name . '/archive.zip'; - break; + default: + self::$storage = $sofascore_data . $storage_name; + self::$zipfile = $sofascore_data . $storage_name . '/archive.zip'; + break; + } + } else if ($folder) { + self::$storage = $sofascore_data; + self::$folder = $folder; } } } diff --git a/app/Console/Commands/Grapper/Sofascore/Grapper.php b/app/Console/Commands/Grapper/Sofascore/Grapper.php index 6ea271d7..e61e1164 100644 --- a/app/Console/Commands/Grapper/Sofascore/Grapper.php +++ b/app/Console/Commands/Grapper/Sofascore/Grapper.php @@ -2,18 +2,18 @@ namespace App\Console\Commands\Grapper\Sofascore; +use App\Utilities\Notice; +use App\Console\Commands\Nuh; +use Illuminate\Support\Carbon; +use App\Models\SofaScoreTaskDay; +use Illuminate\Support\Facades\File; +use App\Models\SofaScoreEventGrapped; +use App\Models\SofaScoreDayTournament; +use App\Models\SofaScoreTaskTournament; use App\Console\Commands\Grapper\Sofascore; +use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper; use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa; use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays; -use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper; -use App\Console\Commands\Nuh; -use App\Models\SofaScoreDayTournament; -use App\Models\SofaScoreEventGrapped; -use App\Models\SofaScoreTaskDay; -use App\Models\SofaScoreTaskTournament; -use App\Utilities\Notice; -use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\File; class Grapper { diff --git a/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php b/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php index 680da4b4..89b4c297 100644 --- a/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php +++ b/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php @@ -2,11 +2,11 @@ namespace App\Console\Commands\Grapper\Sofascore\Helper; +use App\Utilities\Notice; use App\Console\Commands\Nuh; use App\Models\SofaScoreTask; -use App\Models\SofaScoreTaskDay; -use App\Utilities\Notice; use Illuminate\Support\Carbon; +use App\Models\SofaScoreTaskDay; class LoadDays { @@ -18,6 +18,8 @@ class LoadDays $task_id = Nuh::$options['task'] ?? 0; + $folder = Nuh::$options['folder'] ?? 0; + $dates = []; if (!$task_id) { @@ -34,11 +36,19 @@ class LoadDays switch ($task->mode) { case 'daily': - $dates[] = [ - 'day' => Carbon::now()->subDays(3)->format('Y-m-d'), - 'slug' => $task->sport->ss_slug, - 'sport_id' => $task->sport_id, - ]; + if ($folder) { + $dates[] = [ + 'day' => $folder, + 'slug' => $task->sport->ss_slug, + 'sport_id' => $task->sport_id, + ]; + } else { + $dates[] = [ + 'day' => Carbon::now()->subDays(3)->format('Y-m-d'), + 'slug' => $task->sport->ss_slug, + 'sport_id' => $task->sport_id, + ]; + } break; case 'date': diff --git a/app/Console/Commands/Grapper/Sofascore/MakeExcel.php b/app/Console/Commands/Grapper/Sofascore/MakeExcel.php index 0a57ef51..14d86613 100644 --- a/app/Console/Commands/Grapper/Sofascore/MakeExcel.php +++ b/app/Console/Commands/Grapper/Sofascore/MakeExcel.php @@ -29,11 +29,24 @@ class MakeExcel foreach ($files as $key => $value) { - $from = $key * self::$max + 1; - $key++; - $to = $key * self::$max; - $filename = Sofascore::$folder . '-' . $from . '-' . $to . '.xlsx'; + $has = count($value); + if (!$key && $has < self::$max) { + $from = 1; + $to = $has; + } else if (!$key) { + $from = 1; + $key++; + $to = $key * self::$max; + } else if ($has == self::$max) { + $from = $key * self::$max + 1; + $key++; + $to = $key * self::$max; + } else { + $from = $key * self::$max + 1; + $to = $key * self::$max + $has; + } + $filename = Sofascore::$folder . '-' . $from . '-' . $to . '.xlsx'; $spreadsheet = new Spreadsheet; $spreadsheet->getProperties()->setTitle($filename); $activeWorksheet = $spreadsheet->getActiveSheet(); diff --git a/app/Console/Commands/Nuh.php b/app/Console/Commands/Nuh.php index ab453655..458bfb1b 100644 --- a/app/Console/Commands/Nuh.php +++ b/app/Console/Commands/Nuh.php @@ -2,20 +2,20 @@ namespace App\Console\Commands; -use App\Console\Commands\DbMapper\AutoMapper; +use App\Utilities\Notice; +use App\Models\Supervisor; +use Illuminate\Console\Command; +use App\Utilities\Supervisorctl; +use Illuminate\Support\Facades\DB; use App\Console\Commands\Grapper\Betica; +use App\Console\Commands\Grapper\Magloo; +use App\Console\Commands\Grapper\TxOdds; use App\Console\Commands\Grapper\Betsapi; use App\Console\Commands\Grapper\Goldbet; -use App\Console\Commands\Grapper\Logifuture; -use App\Console\Commands\Grapper\Magloo; use App\Console\Commands\Grapper\Sofascore; -use App\Console\Commands\Grapper\TxOdds; use App\Console\Commands\Services\Services; -use App\Models\Supervisor; -use App\Utilities\Notice; -use App\Utilities\Supervisorctl; -use Illuminate\Console\Command; -use Illuminate\Support\Facades\DB; +use App\Console\Commands\Grapper\Logifuture; +use App\Console\Commands\DbMapper\AutoMapper; class Nuh extends Command { @@ -23,7 +23,7 @@ class Nuh extends Command public static $id = 0; - protected $signature = 'nuh {process=help} {--truncate} {--id=0} {--fun=} {--ff} {--task=0} {--restart=0} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}'; + protected $signature = 'nuh {process=help} {--folder=} {--id=0} {--fun=} {--ff} {--task=0} {--restart=0} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}'; public function handle() { @@ -43,19 +43,22 @@ class Nuh extends Command $txt .= '--id=matchid (optional) calling spezific id' . PHP_EOL; $txt .= '--fun=name (optional) [bkms, markets]' . PHP_EOL; $txt .= '--gid=groupid (optional) [bkms, groupid]' . PHP_EOL; - $txt .= '--truncate (optional)' . PHP_EOL; - $txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL; - $txt .= 'Sofascore (67)' . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL; - $txt .= '--fun=[1,2,3,4,5]' - . PHP_EOL . chr(9) . '1) player/season' - . PHP_EOL . chr(9) . '2) setting to local' - . PHP_EOL . chr(9) . '3) grapper' - . PHP_EOL . chr(9) . '4) create zip' - . PHP_EOL . chr(9) . '5) mail folder' - . PHP_EOL; - $txt .= '--task=[id from sofa_score_tasks table]'; - $txt .= '--restart=[0|1] delete archive and flusch DB for taks, start new'; + $txt .= 'Sofascore (67)' . PHP_EOL; + $txt .= '--fun=' . PHP_EOL; + $txt .= chr(9) . 'player_season' . PHP_EOL; + $txt .= chr(9) . 'set_to_local' . PHP_EOL; + $txt .= chr(9) . 'grapper' . PHP_EOL; + $txt .= chr(9) . 'zip' . PHP_EOL; + $txt .= chr(9) . 'mail' . PHP_EOL; + $txt .= chr(9) . 'rose' . PHP_EOL; + $txt .= chr(9) . 'sql_mover' . PHP_EOL; + $txt .= chr(9) . 'excel' . PHP_EOL; + $txt .= chr(9) . 'torunament_teams' . PHP_EOL; + $txt .= chr(9) . 'set_to_production' . PHP_EOL; + $txt .= '--task=[id from sofa_score_tasks table]' . PHP_EOL; + $txt .= '--restart=[0|1] delete archive and flusch DB for taks, start new' . PHP_EOL; + $txt .= '--folder="yyyy-mm-dd" to import files into Excel' . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL; $txt .= 'Options' . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL; diff --git a/app/Filament/Widgets/ChartEvent.php b/app/Filament/Widgets/ChartEvent.php index b8f17274..40763b77 100644 --- a/app/Filament/Widgets/ChartEvent.php +++ b/app/Filament/Widgets/ChartEvent.php @@ -2,12 +2,12 @@ namespace App\Filament\Widgets; -use App\Filament\Widgets\Data\HelperStatisticType; -use App\Filament\Widgets\Data\LoadEvents; use Filament\Support\RawJs; use Filament\Widgets\ChartWidget; -use Illuminate\Support\HtmlString; use Livewire\Attributes\Reactive; +use Illuminate\Support\HtmlString; +use App\Filament\Widgets\Data\LoadEvents; +use App\Filament\Widgets\Data\HelperStatisticType; class ChartEvent extends ChartWidget { diff --git a/app/Filament/Widgets/Data/LoadPerformance.php b/app/Filament/Widgets/Data/LoadPerformance.php index 3e98722b..e29232db 100644 --- a/app/Filament/Widgets/Data/LoadPerformance.php +++ b/app/Filament/Widgets/Data/LoadPerformance.php @@ -165,8 +165,8 @@ class LoadPerformance 'data' => $homes['def'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', - 'backgroundColor' => '#e60076', + 'borderColor' => '#fe9a00', + 'backgroundColor' => '#fe9a00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -179,7 +179,7 @@ class LoadPerformance 'data' => $home_av['def'], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', + 'borderColor' => '#fe9a00', 'backgroundColor' => 'transparent', 'pointStyle' => false, 'hidden' => true, @@ -193,8 +193,8 @@ class LoadPerformance 'data' => $homes['att'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', - 'backgroundColor' => '#e60076', + 'borderColor' => '#fe9a00', + 'backgroundColor' => '#fe9a00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -207,7 +207,7 @@ class LoadPerformance 'data' => $home_av['att'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', + 'borderColor' => '#fe9a00', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, @@ -222,8 +222,8 @@ class LoadPerformance 'data' => $homes['mid'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', - 'backgroundColor' => '#e60076', + 'borderColor' => '#fe9a00', + 'backgroundColor' => '#fe9a00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -236,7 +236,7 @@ class LoadPerformance 'data' => $home_av['mid'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#e60076', + 'borderColor' => '#fe9a00', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, @@ -251,8 +251,8 @@ class LoadPerformance 'data' => $aways['all'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#00c950', - 'backgroundColor' => '#00c950', + 'borderColor' => '#00bc7d', + 'backgroundColor' => '#00bc7d', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => false, @@ -265,7 +265,7 @@ class LoadPerformance 'data' => $away_av['all'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#00c950', + 'borderColor' => '#00bc7d', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, @@ -280,8 +280,8 @@ class LoadPerformance 'data' => $aways['def'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', - 'backgroundColor' => '#009966', + 'borderColor' => '#7ccf00', + 'backgroundColor' => '#7ccf00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -294,7 +294,7 @@ class LoadPerformance 'data' => $away_av['def'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', + 'borderColor' => '#7ccf00', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, @@ -309,8 +309,8 @@ class LoadPerformance 'data' => $aways['att'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', - 'backgroundColor' => '#009966', + 'borderColor' => '#7ccf00', + 'backgroundColor' => '#7ccf00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -323,7 +323,7 @@ class LoadPerformance 'data' => $away_av['att'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', + 'borderColor' => '#7ccf00', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, @@ -338,8 +338,8 @@ class LoadPerformance 'data' => $aways['mid'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', - 'backgroundColor' => '#009966', + 'borderColor' => '#7ccf00', + 'backgroundColor' => '#7ccf00', 'fill' => false, 'pointStyle' => $hasdots, 'hidden' => true, @@ -352,7 +352,7 @@ class LoadPerformance 'data' => $away_av['mid'] ?? [], 'spanGaps' => true, 'tension' => 0.5, - 'borderColor' => '#009966', + 'borderColor' => '#7ccf00', 'backgroundColor' => 'transparent', 'fill' => false, 'pointStyle' => false, diff --git a/grapper.sh b/grapper.sh index 42ccbe30..e45bb8a1 100755 --- a/grapper.sh +++ b/grapper.sh @@ -19,13 +19,13 @@ case "$1" in ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 echo "\n⚽ Settings To Local" - php artisan nuh --d --f 67 --fun=2 --task=0 + php artisan nuh --d --f 67 --fun=set_to_local --task=0 echo "\n⚽ close vpn" killall ssh echo "\n⚽ Grapper" - php artisan nuh --d --f --ff 67 --fun=3 --task=1 + php artisan nuh --d --f --ff 67 --fun=grapper --task=1 # echo "\n⚽ Create Zip" # php artisan nuh --d --f 67 --fun=4 --task=1