This commit is contained in:
salam committed 2026-08-04 16:32:51 +02:00
1 parent 2b591ad8cf
commit ad0724f61b
8 files changed
+145 -117

No files matched your search

+51 -49
View File
@@ -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;
}
}
}
@@ -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
{
@@ -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':
@@ -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();
+25 -22
View File
@@ -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;