wip
This commit is contained in:
1 parent
2b591ad8cf
commit
ad0724f61b
8 files changed
+145
-117
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user