fix update player

This commit is contained in:
salam committed 2026-09-11 10:36:16 +02:00
1 parent e3f1e8a8d9
commit f028a8b2a8
16 files changed
+605 -224

No files matched your search

+25 -23
View File
@@ -2,7 +2,6 @@
namespace App\Console\Commands;
use App\Actions\PlayerPerSeason;
use App\Console\Commands\Grapper\Sofascore\Grapper;
use App\Console\Commands\Grapper\Sofascore\GrapperTest;
use App\Console\Commands\Grapper\Sofascore\Helper\SetStorage;
@@ -11,11 +10,14 @@ 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\SqlMover;
use App\Traits\UpdatePlayerSeasonHelper;
use App\Utilities\Notice;
use Illuminate\Console\Command;
class Grap extends Command
{
use UpdatePlayerSeasonHelper;
public static $options = [];
public static string $storage;
@@ -38,29 +40,29 @@ class Grap extends Command
self::$options['base_url'] = 'https://www.sofascore.com/';
if (! self::$options['id']) {
$txt = 'PARAMETERS' . PHP_EOL;
$txt .= '--d debug' . PHP_EOL;
$txt .= '--r restart range' . PHP_EOL;
$txt .= '--f force' . PHP_EOL;
$txt .= '--m mail only' . PHP_EOL;
$txt .= '--R read file' . PHP_EOL;
$txt .= '--S save to file' . PHP_EOL;
$txt .= '--folder' . PHP_EOL;
$txt .= '-----------------------------------------------------------' . PHP_EOL;
$txt .= 'FUNCTION' . PHP_EOL;
$txt .= ' 1 grapper DAILY & subDays ( default 3)' . PHP_EOL;
$txt .= ' 2 grapper DATE' . PHP_EOL;
$txt .= ' 3 grapper RANGE' . PHP_EOL;
$txt .= ' 4 grapper ROSE' . PHP_EOL;
$txt .= ' 5 import to excel from folder' . PHP_EOL;
$txt .= ' 6 PlayerPerSeason pre calcuation' . PHP_EOL;
$txt .= ' 7 settings to local' . PHP_EOL;
$txt .= ' 11 move SQL' . PHP_EOL;
$txt .= ' 12 testing url for grapping' . PHP_EOL;
$txt = 'PARAMETERS'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
$txt .= '--r restart range'.PHP_EOL;
$txt .= '--f force'.PHP_EOL;
$txt .= '--m mail only'.PHP_EOL;
$txt .= '--R read file'.PHP_EOL;
$txt .= '--S save to file'.PHP_EOL;
$txt .= '--folder'.PHP_EOL;
$txt .= '-----------------------------------------------------------'.PHP_EOL;
$txt .= 'FUNCTION'.PHP_EOL;
$txt .= ' 1 grapper DAILY & subDays ( default 3)'.PHP_EOL;
$txt .= ' 2 grapper DATE'.PHP_EOL;
$txt .= ' 3 grapper RANGE'.PHP_EOL;
$txt .= ' 4 grapper ROSE'.PHP_EOL;
$txt .= ' 5 import to excel from folder'.PHP_EOL;
$txt .= ' 6 update PlayerPerSeason'.PHP_EOL;
$txt .= ' 7 settings to local'.PHP_EOL;
$txt .= ' 11 move SQL'.PHP_EOL;
$txt .= ' 12 testing url for grapping'.PHP_EOL;
Notice::note($txt, 'b', 1);
}
Notice::note('Task Id ' . self::$options['id'], 'gb');
Notice::note('Task Id '.self::$options['id'], 'gb');
switch (self::$options['id']) {
@@ -70,7 +72,7 @@ class Grap extends Command
// MoveToArchive::move(1);
// with --m just resend mail
if (!self::$options['m']) {
if (! self::$options['m']) {
Grapper::load(1);
MakeExcel::create();
}
@@ -104,7 +106,7 @@ class Grap extends Command
break;
case 6:
PlayerPerSeason::run();
$this->update(1000000);
break;
case 7:
-128
View File
@@ -1,128 +0,0 @@
<?php
namespace App\Console\Commands\Grapper;
use App\Utilities\Notice;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTask;
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);
class Sofascore
{
public static string $storage;
public static string $zipfile;
public static string $folder;
public static string $useragent = '4';
public static function switch()
{
$function = Nuh::$options['fun'];
switch ($function) {
case 'player_season':
PlayerPerSeason::run();
break;
case 'set_to_local':
SettingsToLocal::run();
break;
case 'grapper':
self::setStorage();
Grapper::load();
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 'excel':
self::setStorage();
MakeExcel::create();
break;
case 'torunament_teams':
TournamentTeams::get();
break;
case 'set_to_production':
SettingsToProduction::run();
break;
default:
Notice::note('not a valid fuction', 'br', 1);
}
}
public static function setStorage()
{
$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) {
$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;
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;
}
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Console\Commands;
use App\Traits\UpdatePlayerSeasonHelper;
use Illuminate\Console\Command;
class Upd extends Command
{
use UpdatePlayerSeasonHelper;
protected $signature = 'upd {--d}';
protected $description = 'update sofa_score_player_per_seasons';
public function handleUpdate(int $playerCount): void
{
$this->update($playerCount);
}
}