115 lines
3.0 KiB
PHP
115 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Console\Commands\Grapper\Sofascore\Grapper;
|
|
use App\Console\Commands\Grapper\Sofascore\Helper\SetStorage;
|
|
use App\Console\Commands\Grapper\Sofascore\MakeExcel;
|
|
use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason;
|
|
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
|
|
use App\Utilities\Notice;
|
|
use Illuminate\Console\Command;
|
|
|
|
class Grap extends Command
|
|
{
|
|
public static $options = [];
|
|
|
|
public static string $storage;
|
|
|
|
public static string $zipfile;
|
|
|
|
public static string $folder;
|
|
|
|
public static $id = 0;
|
|
|
|
public static string $useragent = '4';
|
|
|
|
protected $signature = 'grp {id=0} {task=0} {--d} {--r} {--f}';
|
|
|
|
public function handle()
|
|
{
|
|
self::$options = $this->options();
|
|
|
|
self::$options['task'] = $this->argument('task');
|
|
|
|
self::$options['base_url'] = 'https://www.sofascore.com/';
|
|
|
|
$id = $this->argument('id');
|
|
|
|
if (!$id) {
|
|
$txt = 'PARAMETERS' . PHP_EOL;
|
|
$txt .= '--d debug' . PHP_EOL;
|
|
$txt .= '--r restart range' . PHP_EOL;
|
|
$txt .= '--f force' . PHP_EOL;
|
|
$txt .= '-----------------------------------------------------------' . PHP_EOL;
|
|
$txt .= 'FUNCTION' . PHP_EOL;
|
|
$txt .= " 1\tPlayerPerSeason" . PHP_EOL;
|
|
$txt .= " 2\tSettingsToLocal" . PHP_EOL;
|
|
$txt .= '-----------------------------------------------------------' . PHP_EOL;
|
|
$txt .= 'TASK' . PHP_EOL;
|
|
$txt .= " 1\tgrapper daily" . PHP_EOL;
|
|
$txt .= " 2\tgrapper" . PHP_EOL;
|
|
Notice::note($txt, 'b', 1);
|
|
}
|
|
|
|
switch ($id) {
|
|
|
|
case 1:
|
|
Notice::note('PlayerPerSeason sleep 5', 'bb');
|
|
sleep(5);
|
|
|
|
PlayerPerSeason::run();
|
|
break;
|
|
|
|
case 2:
|
|
Notice::note('SettingsToLocal sleep 5', 'bb');
|
|
sleep(5);
|
|
|
|
SettingsToLocal::run();
|
|
break;
|
|
|
|
case 3:
|
|
SetStorage::set();
|
|
Grapper::load();
|
|
break;
|
|
|
|
case 4:
|
|
SetStorage::set();
|
|
MakeExcel::create();
|
|
break;
|
|
|
|
// case 'zip':
|
|
// self::setStorage();
|
|
// ZipFolder::create();
|
|
// break;
|
|
|
|
// case 'mail':
|
|
// self::setStorage();
|
|
// SendMail::run();
|
|
// break;
|
|
|
|
// case 'rose':
|
|
// self::setStorage();
|
|
// Rose::run();
|
|
// break;
|
|
|
|
// case 'sql_mover':
|
|
// SqlMover::run();
|
|
// break;
|
|
|
|
|
|
|
|
// case 'torunament_teams':
|
|
// TournamentTeams::get();
|
|
// break;
|
|
|
|
// case 'set_to_production':
|
|
// SettingsToProduction::run();
|
|
// break;
|
|
|
|
default:
|
|
Notice::note('not a valid fuction', 'br', 1);
|
|
}
|
|
}
|
|
}
|