This commit is contained in:
salam committed 2026-07-03 07:40:17 +02:00
1 parent cd91e3b708
commit c30aaa15fe
32 files changed
+345 -10140

No files matched your search

+48 -55
View File
@@ -2,80 +2,73 @@
namespace App\Console\Commands\Grapper; namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Sofascore\Events; use App\Console\Commands\Grapper\Sofascore\CreateZip;
use App\Console\Commands\Grapper\Sofascore\EventsDatabase; use App\Console\Commands\Grapper\Sofascore\DaysTournament;
use App\Console\Commands\Grapper\Sofascore\Special; use App\Console\Commands\Grapper\Sofascore\Grapper;
use App\Console\Commands\Grapper\Sofascore\Tournament; use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays;
use App\Console\Commands\Grapper\Sofascore\Helper\TaskConfig;
use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason;
use App\Console\Commands\Grapper\Sofascore\SendMail;
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Utilities\Notice; use App\Utilities\Notice;
use DateTime;
use Illuminate\Support\Carbon; ini_set('magic_quotes_runtime', false);
class Sofascore class Sofascore
{ {
public static $auth_header = [];
public static $base_url = ''; public static string $source_path;
public static $_days = []; public static string $storage_path;
public static $sport = [1];
public static function switch() public static function switch()
{ {
$debug = Nuh::$options['d'] ?? 0; self::$source_path = app_path('/Console/Commands/Grapper/Sofascore/Grapped');
if (Nuh::$options['t']) { self::$storage_path = storage_path('zip_sofascore_data');
self::$_days[] = Carbon::now()->format('Y-m-d');
} elseif (Nuh::$options['day']) {
$day = self::validateDate(Nuh::$options['day']);
if ($day) {
self::$_days[] = $day;
} else {
Notice::note('date not valid '.Nuh::$options['day'], 'r', 1);
}
} elseif (Nuh::$options['days']) {
$to = Carbon::now()->subDays(Nuh::$options['days']);
$from = Carbon::now()->subDay();
while ($from >= $to) {
self::$_days[] = $from->format('Y-m-d');
$from->subDay();
}
}
if ($debug) { $task = Nuh::$options['task'] ?? 0;
Notice::note(Nuh::$options['sport'] ?? 'All'.' '.Nuh::$options['name'], 'bb');
}
switch (Nuh::$options['name']) { $process = Nuh::$options['run'];
case 'TOURNAMENTS':
Tournament::load(); $days = LoadDays::load($task);
switch($process){
case 1:
PlayerPerSeason::run();
break; break;
case 'EVENTS': case 2:
Events::load(); SettingsToLocal::run();
break; break;
case 'EVENTSDB': case 3:
EventsDatabase::load(); if($days){
CreateZip::run($days);
}
break; break;
case 'SPECIAL': case 4:
Special::load(); if($days){
SendMail::run($days);
}
break;
case 5:
if($days){
DaysTournament::run($days);
}
break;
case 6:
if($days){
Grapper::load($days);
}
break;
case 7:
if($days){
TaskConfig::set($task);
}
break; break;
default: default:
// code... Notice::note('id not valid', 'br', 1);
break;
}
}
public static function validateDate($date, $format = 'Y-m-d')
{
if (is_numeric($date)) {
$date = date('Y').'-'.date('m').'-'.$date;
}
$d = DateTime::createFromFormat($format, $date);
if ($d && $d->format($format) == $date) {
return $d->format($format);
} }
} }
} }
@@ -1,2 +0,0 @@
grapped/
worldcup-teams/
@@ -0,0 +1,26 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
use App\Utilities\ZipFolder;
class CreateZip
{
public static function run(array $days)
{
$debug = Nuh::$options['d'] ?? 0;
foreach ($days as $d) {
$day = $d['day'];
ZipFolder::create($day);
}
if ($debug) {
Notice::note(\count($days).' days as zip created', 'bb');
}
}
}
@@ -3,7 +3,6 @@
namespace App\Console\Commands\Grapper\Sofascore\Specials; namespace App\Console\Commands\Grapper\Sofascore\Specials;
use App\Console\Commands\Grapper\Sofascore\CurlSofa; use App\Console\Commands\Grapper\Sofascore\CurlSofa;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Console\Commands\Grapper\Sofascore\Tools\Sleeper; use App\Console\Commands\Grapper\Sofascore\Tools\Sleeper;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Models\Country; use App\Models\Country;
@@ -15,12 +14,10 @@ use Illuminate\Support\Facades\Log;
class DaysTournament class DaysTournament
{ {
public static function run() public static function run(array $days)
{ {
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$days = LoadDays::load();
$tournaments_counter = 0; $tournaments_counter = 0;
foreach ($days as $d) { foreach ($days as $d) {
@@ -1,180 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreDayTournament;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\File;
class Events
{
public static $storage_path = '/Console/Commands/Grapper/Sofascore/grapped/';
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$print = Nuh::$options['p'] ?? 0;
$sport_id = Nuh::$options['sport_id'];
$dback = Nuh::$options['days'] ?? 1;
$singleday = Nuh::$options['day'] ?? 0;
if ($singleday) {
$dback = 1;
}
if ($print) {
for ($i = 1; $i <= $dback; $i++) {
$day = Carbon::now()->subDays($i)->format('Y-m-d');
if ($debug) {
Notice::note($day, 'p');
}
if (Nuh::$options['groups']) {
$tornaments = explode(',', Nuh::$options['groups']) ?? 0;
$ss_days = SofaScoreDayTournament::with('tournament')
->when($tornaments, function ($query) use ($tornaments) {
return $query->whereIn('tournament_id', $tornaments);
})
->whereHas('tournament', function ($query) use ($sport_id) {
$query->where('sport_id', $sport_id);
})
->where('day', $day)->get();
Notice::note($ss_days, 'p');
}
}
exit;
}
/**
* world cup => 16
* finland veikkaus => 41
*/
$tornaments = explode(',', Nuh::$options['groups']) ?? 0;
if (array_sum($tornaments)) {
if ($debug) {
Notice::note('groups and day(s) used from comandline', 'p');
}
if (! Nuh::$options['days'] or ! Nuh::$options['day']) {
Notice::note('no day(s) option in comandline (--day=1)', 'r', 1);
}
}
for ($i = 1; $i <= $dback; $i++) {
// remove one day to start yesterday
$day = Carbon::now()->subDays($i)->format('Y-m-d');
// call for spezific day
if ($singleday) {
$dback = 1;
$day = $singleday;
}
if ($debug) {
Notice::note($day, 'p');
}
$ss_days = SofaScoreDayTournament::with('tournament')
->when($tornaments, function ($query) use ($tornaments) {
return $query->whereIn('tournament_id', $tornaments);
})
->whereHas('tournament', function ($query) use ($sport_id) {
$query->where('sport_id', $sport_id);
})
->where('day', $day)->get();
foreach ($ss_days as $ss_day) {
$sofa_score_categorie_id = $ss_day->tournament->sofa_score_categorie_id;
$tournament_id = $ss_day->tournament_id;
// $url = Nuh::$options['base_url'] . "api/v1/category/$sofa_score_categorie_id/scheduled-events/$day";
$url = Nuh::$options['base_url']."api/v1/unique-tournament/$tournament_id/scheduled-events/$day";
$rand = rand(500000, 1000000);
if ($debug) {
Notice::note("Sleep $rand msec", 'y');
}
usleep($rand);
$data = CurlSofa::load($url);
Nuh::$options['s'] = 0;
Nuh::$options['r'] = 0;
foreach ($data['events'] as $event) {
Notice::note($event['season']['name'].' '.$ss_day->day, 'bb');
$folder = app_path().self::$storage_path.$ss_day->day.'/'.$event['tournament']['slug'].'/'.$event['slug'];
File::makeDirectory($folder, 0775, true, true);
/*********************************
* EVENT event
*********************************/
File::put($folder.'/event.json', json_encode($event));
/*********************************
* EVENT statistics
*********************************/
$event_id = $event['id'];
$url = Nuh::$options['base_url']."api/v1/event/$event_id/statistics";
$rand = rand(500000, 1000000);
if ($debug) {
Notice::note("Sleep $rand msec", 'y');
}
usleep($rand);
$data = CurlSofa::load($url);
File::put($folder.'/statistics.json', json_encode($data));
/*********************************
* EVENT lineups
*********************************/
$event_id = $event['id'];
$url = Nuh::$options['base_url']."api/v1/event/$event_id/lineups";
$rand = rand(500000, 1000000);
if ($debug) {
Notice::note("Sleep $rand msec", 'y');
}
usleep($rand);
$data = CurlSofa::load($url);
File::put($folder.'/lineups.json', json_encode($data));
/*********************************
* EVENT lineups
*********************************/
$event_id = $event['id'];
$url = Nuh::$options['base_url']."api/v1/event/$event_id/odds/1/all";
$rand = rand(500000, 1000000);
if ($debug) {
Notice::note("Sleep $rand msec", 'y');
}
usleep($rand);
$data = CurlSofa::load($url);
File::put($folder.'/odds.json', json_encode($data));
}
}
}
}
}
@@ -0,0 +1 @@
*/*
@@ -2,28 +2,25 @@
namespace App\Console\Commands\Grapper\Sofascore; namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays; use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
use App\Console\Commands\Grapper\Sofascore\Tools\Sleeper;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Models\SofaScoreDayTournament; use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament; use App\Models\SofaScoreTournament;
use App\Utilities\Notice; use App\Utilities\Notice;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
class EventsDatabase class Grapper
{ {
public static $storage_path = '/Console/Commands/Grapper/Sofascore/grapped/'; public static function load(array $days)
public static function load()
{ {
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$days = LoadDays::load();
foreach ($days as $d) { foreach ($days as $d) {
$langsam = $d['run_slow']; $langsam = $d['run_slow'];
$sport_id = $d['sport_id']; $sport_id = $d['sport_id'];
$day = $d['day']; $day = $d['day'];
$active_tournaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get(); $active_tournaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();
@@ -69,6 +66,8 @@ class EventsDatabase
$event_id = $event['id']; $event_id = $event['id'];
if(!File::file_exists($folder.'/statistics.json')){
$url = Nuh::$options['base_url']."api/v1/event/$event_id/statistics"; $url = Nuh::$options['base_url']."api/v1/event/$event_id/statistics";
Sleeper::rand($langsam); Sleeper::rand($langsam);
@@ -78,11 +77,14 @@ class EventsDatabase
$data['id'] = $event_id; $data['id'] = $event_id;
File::put($folder.'/statistics.json', json_encode($data)); File::put($folder.'/statistics.json', json_encode($data));
}
/********************************* /*********************************
* EVENT lineups * EVENT lineups
*********************************/ *********************************/
if(!File::file_exists($folder.'/lineups.json')){
$url = Nuh::$options['base_url']."api/v1/event/$event_id/lineups"; $url = Nuh::$options['base_url']."api/v1/event/$event_id/lineups";
Sleeper::rand($langsam); Sleeper::rand($langsam);
@@ -92,11 +94,14 @@ class EventsDatabase
$data['id'] = $event_id; $data['id'] = $event_id;
File::put($folder.'/lineups.json', json_encode($data)); File::put($folder.'/lineups.json', json_encode($data));
}
/********************************* /*********************************
* EVENT lineups * EVENT odds
*********************************/ *********************************/
if(!File::file_exists($folder.'/odds.json')){
$url = Nuh::$options['base_url']."api/v1/event/$event_id/odds/1/all"; $url = Nuh::$options['base_url']."api/v1/event/$event_id/odds/1/all";
Sleeper::rand($langsam); Sleeper::rand($langsam);
@@ -107,6 +112,24 @@ class EventsDatabase
File::put($folder.'/odds.json', json_encode($data)); File::put($folder.'/odds.json', json_encode($data));
} }
/*********************************
* EVENT incidents
*********************************/
if(!File::file_exists($folder.'/incidents.json')){
$url = Nuh::$options['base_url']."api/v1/event/$event_id/incidents";
Sleeper::rand($langsam);
$data = CurlSofa::load($url);
$data['id'] = $event_id;
File::put($folder.'/incidents.json', json_encode($data));
}
}
} }
} else { } else {
if ($debug) { if ($debug) {
@@ -0,0 +1,100 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Helper;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTask;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class LoadDays
{
public static function load(int $task_id)
{
$debug = Nuh::$options['d'] ?? 0;
$dates = [];
if(!$task_id){
Notice::note('no task id', 'br');
return [];
}
$res = SofaScoreTask::with('sport')->where('is_active', 1)->where('id', $task_id)->first();
if(!$debug){
Notice::note('grapper: '.$res->mode.' sport: '.$res->sport_id);
}
foreach ($res as $row) {
switch ($row->mode) {
case 'yesterday':
$dates[] = [
'day' => Carbon::now()->subDay()->format('Y-m-d'),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
break;
case 'date':
$dates[] = [
'day' => self::validateDate($row->day_from),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
break;
case 'range':
$from = self::validateDate($row->day_from);
$to = self::validateDate($row->day_to);
$from = Carbon::createFromDate($from);
$to = Carbon::createFromDate($to);
$lengthdates = $from->diffInDays($to);
if ($lengthdates < 1) {
Notice::note('wrong date start must be before end', 'r', 1);
} elseif ($lengthdates > 60) {
Notice::note('wrong date maximal 60 dates allowed', 'r', 1);
}
while ($from < $to) {
$dates[] = [
'day' => $from->format('Y-m-d'),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
$from->addDay();
}
break;
}
if (! $dates) {
Notice::note(__FILE__.PHP_EOL.'no dates', 'r', 1);
}
}
// remove when element in array is double (day and slug)
$dates = array_unique($dates, SORT_REGULAR);
return $dates;
}
public static function validateDate(string $date)
{
if (Carbon::createFromDate($date) !== false) {
return $date;
} else {
Notice::note('Wrong date format', 'r', 1);
}
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Tools;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTournament;
use App\Utilities\Notice;
class LoadTournaments
{
public static function load()
{
$sport_id = Nuh::$options['sport_id'];
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();
if (! $tornaments) {
Notice::note('no tornaments active for task', 'r', 1);
}
return $tornaments;
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Helper;
use App\Models\SofaScoreTask;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class TaskConfig
{
public static function set(int $task_id)
{
if(!$task_id){
Notice::note('no task id', 'br');
return [];
}
$res = SofaScoreTask::with('sport')->where('id', $task_id)->first();
if($res->run_repeatedly){
SofaScoreTask::query()->where('id', $task_id)->update(['compleated' => 1]);
}
else {
SofaScoreTask::query()->where('id', $task_id)->update(['compleated' => 1, 'is_active' => 0, 'last_end' => Carbon::now()->format('Y-m-d')]);
}
}
}
@@ -1,17 +1,25 @@
<?php <?php
namespace App\Console\Commands\Grapper\Sofascore\Specials; namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Models\SofaScorePlayerPerSeason; use App\Models\SofaScorePlayerPerSeason;
use App\Models\StatistikoDetail; use App\Models\StatistikoDetail;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use App\Utilities\Notice;
class PlayerPerSeason class PlayerPerSeason
{ {
public static function run() public static function run()
{ {
$debug = Nuh::$options['d'] ?? 0;
$res = StatistikoDetail::query()->select('tm_player_id', 'txodds_id')->get(); $res = StatistikoDetail::query()->select('tm_player_id', 'txodds_id')->get();
if ($debug) {
Notice::note('process '.$res->count() ." player", 'bb');
}
foreach ($res as $val) { foreach ($res as $val) {
$collection = []; $collection = [];
@@ -56,5 +64,9 @@ class PlayerPerSeason
} }
} }
} }
if ($debug) {
Notice::note("done", 'bb');
}
} }
} }
@@ -1,23 +1,20 @@
<?php <?php
namespace App\Console\Commands\Grapper\Sofascore\Specials; namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Special; use App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Utilities\Notice; use App\Utilities\Notice;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
class SendMail class SendMail
{ {
public static function run() public static function run(array $days)
{ {
$days = LoadDays::load();
foreach ($days as $d) { foreach ($days as $d) {
$day = $d['day']; $day = $d['day'];
$zip_file = Special::$storage_path.'/'.$day.'.zip'; $zip_file = Sofascore::$storage_path.'/'.$day.'.zip';
Mail::send([], [], function ($message) use ($day, $zip_file) { Mail::send([], [], function ($message) use ($day, $zip_file) {
@@ -1,15 +1,23 @@
<?php <?php
namespace App\Console\Commands\Grapper\Sofascore\Specials; namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTask; use App\Models\SofaScoreTask;
use App\Models\SofaScoreTaskTournament; use App\Models\SofaScoreTaskTournament;
use App\Utilities\Notice;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class SettingsToLocal class SettingsToLocal
{ {
public static function run() public static function run()
{ {
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('copy settings to local', 'bb');
}
SofaScoreTask::truncate(); SofaScoreTask::truncate();
$rows = DB::connection('remote_mariadb')->table('sofa_score_tasks')->get(); $rows = DB::connection('remote_mariadb')->table('sofa_score_tasks')->get();
foreach ($rows as $row) { foreach ($rows as $row) {
@@ -1,68 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Specials\CreateZip;
use App\Console\Commands\Grapper\Sofascore\Specials\DaysTournament;
use App\Console\Commands\Grapper\Sofascore\Specials\PlayerPerSeason;
use App\Console\Commands\Grapper\Sofascore\Specials\SendMail;
use App\Console\Commands\Grapper\Sofascore\Specials\SettingsToLocal;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
ini_set('magic_quotes_runtime', false);
class Special
{
public static string $source_path;
public static string $storage_path;
public static function load()
{
self::$source_path = app_path('/Console/Commands/Grapper/Sofascore/grapped');
self::$storage_path = storage_path('zip_sofascore_data');
$debug = Nuh::$options['d'] ?? 0;
$process = Nuh::$options['prc'];
switch($process){
case 1:
if($debug){
Notice::note('player active per season', 'y');
}
PlayerPerSeason::run();
break;
case 2:
if($debug){
Notice::note('copy active tournament to local', 'y');
}
SettingsToLocal::run();
break;
case 3:
if($debug){
Notice::note('create a zip archive', 'y');
}
CreateZip::run();
break;
case 4:
if($debug){
Notice::note('mail given folder', 'y');
}
SendMail::run();
break;
case 5:
if($debug){
Notice::note('grap tornamenst available for given day', 'y');
}
DaysTournament::run();
break;
default:
Notice::note('run special "prc" id missing', 'br', 1);
}
}
}
@@ -1,24 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Specials;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Utilities\Notice;
use App\Utilities\ZipFolder;
class CreateZip
{
public static function run()
{
$days = LoadDays::load();
foreach ($days as $d) {
$day = $d['day'];
ZipFolder::create($day);
}
Notice::note('Archive created', 'g', 1);
}
}
@@ -1,92 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Tools;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTask;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class LoadDays
{
public static function load()
{
$today = Nuh::$options['t'] ?? 0;
$yesterday = Nuh::$options['y'] ?? 0;
if ($today) {
return [Carbon::now()->format('Y-m-d')];
} elseif ($yesterday) {
return [Carbon::now()->subDay()->format('Y-m-d')];
} else {
$res = SofaScoreTask::with('sport')->where('is_active', 1)->get();
$dates = [];
foreach ($res as $row) {
switch ($row->mode) {
case 'yesterday':
$dates[] = [
'day' => Carbon::now()->subDay()->format('Y-m-d'),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
break;
case 'date':
$dates[] = [
'day' => self::validateDate($row->day_from),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
break;
case 'range':
$from = self::validateDate($row->day_from);
$to = self::validateDate($row->day_to);
$from = Carbon::createFromDate($from);
$to = Carbon::createFromDate($to);
$lengthdates = $from->diffInDays($to);
if ($lengthdates < 1) {
Notice::note('wrong date start must be before end', 'r', 1);
} elseif ($lengthdates > 60) {
Notice::note('wrong date maximal 60 dates allowed', 'r', 1);
}
while ($from < $to) {
$dates[] = [
'day' => $from->format('Y-m-d'),
'slug' => $row->sport->ss_slug,
'run_slow' => $row->run_slow,
'sport_id' => $row->sport_id,
'run_repeatedly' => $row->run_repeatedly,
];
$from->addDay();
}
}
if (! $dates) {
Notice::note(__FILE__.PHP_EOL.'no dates', 'r', 1);
}
}
}
// remove when element in array is double (day and slug)
$dates = array_unique($dates, SORT_REGULAR);
return $dates;
}
public static function validateDate(string $date)
{
if (Carbon::createFromDate($date) !== false) {
return $date;
} else {
Notice::note('Wrong date format', 'r', 1);
}
}
}
@@ -1,35 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Tools;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreTournament;
use App\Utilities\Notice;
/**
* FIFA World Cup 16
* China Super League 649
* Veikkausliiga 41
*/
class LoadTournaments
{
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$print = Nuh::$options['p'] ?? 0;
$sport_id = Nuh::$options['sport_id'];
$grps = Nuh::$options['grps'] ?? 0;
if ($grps) {
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->whereIn('tournament_id', explode(',', $grps))->where('enabled', 1)->get();
} else {
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();
}
if (! $tornaments) {
Notice::note(__FILE__.PHP_EOL.'no tornaments', 'r', 1);
}
return $tornaments;
}
}
@@ -1,193 +0,0 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Models\Country;
use App\Models\SofaScoreCategorie;
use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament;
use App\Models\Sport;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
class Tournament
{
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$dback = Nuh::$options['days'] ?? 1;
$singleday = Nuh::$options['day'] ?? 0;
if($singleday){
$dback = 1;
}
$force = Nuh::$options['f'] ?? 0;
$sport_id = Nuh::$options['sport_id'];
$sport = Sport::where('id', $sport_id)->first();
for ($i = 1; $i <= $dback; $i++) {
// remove one day to start yesterday
$day = Carbon::now()->subDays($i)->format('Y-m-d');
// call for spezific day
if($singleday){
$dback = 1;
$day = $singleday;
}
if ($debug) {
Notice::note($day, 'p');
}
$tournaments_counter = 0;
Notice::note('needs day fixing', 'br', 1);
/**
* grap only one time/sport check
*/
if ($force) {
if ($debug) {
Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'p');
}
$page = 1;
while ($page) {
$url = Nuh::$options['base_url'] . "api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
$rand = rand(500000, 1000000);
if ($debug) {
Notice::note("Sleep $rand msec", 'y');
}
usleep($rand);
$data = CurlSofa::load($url);
if ($data['hasNextPage']) {
$page++;
} else {
$page = false;
}
// $page = false;
foreach ($data['scheduled'] as $row) {
if (isset($row['tournament']['uniqueTournament'])) {
$tournament = $row['tournament']['uniqueTournament'];
} else {
$tournament = $row['tournament'];
}
$category = $tournament['category'];
if ($sport_id == 5) {
$country_id = 470;
} else {
/**
* CATEGORY
*/
$find = [
'Amateur',
'Bosnia & Herzegovina',
'Czechia',
'DR Congo',
'Netherlands',
'North & Central America',
'Bonaire',
'Sao Tome and Principe',
'Cape Verde',
'Macao',
'Saint Kitts and Nevis',
'Eswatini',
'Timor Leste',
'Laos',
'Congo Republic',
];
$replace = [
'',
'Bosnia Herzegovina',
'Czech Republic',
'Congo DR',
'Holland',
'North America',
'Bonaire, Sint Eustatius and Saba',
'Sao Tome e Principe',
'Cape Verde Islands',
'Macau',
'St. Kitts and Nevis',
'Swaziland',
'East Timor',
'Lao Peoples\'s Democratic Republic',
'Congo DR',
];
$country_id = Country::where('name', trim(str_replace($find, $replace, $category['name'])))->value('id');
}
// dd($category, $country_id);
if (! $country_id) {
// platzhalter fix later sofa_score_categories => txodds countries
// CATEGORY find <-> replace
Log::channel('sofascore')->info($tournament);
$sofa_score_categorie_id = 10000000;
} else {
$call = SofaScoreCategorie::updateOrCreate([
'id' => (int) $category['id'],
'country_id' => (int) $country_id,
'slug' => $category['slug'],
], [
'name' => $category['name'],
]);
$sofa_score_categorie_id = $call->id;
}
/**
* TOURNAMENT
*/
SofaScoreTournament::updateOrCreate([
'sport_id' => (int) $sport_id,
'tournament_id' => (int) $tournament['id'],
'sofa_score_categorie_id' => (int) $sofa_score_categorie_id,
], [
'name' => $tournament['name'],
'slug' => $tournament['slug'],
]);
$tournaments_counter++;
/**
* DAY TOURNAMENT
*/
SofaScoreDayTournament::updateOrCreate([
'tournament_id' => (int) $tournament['id'],
'day' => $day,
]);
}
if ($debug) {
Notice::note("tournaments: $tournaments_counter", 'p');
}
}
} else {
if ($debug) {
Notice::note(Nuh::$options['sport'] . ' ' . $day, 'b');
}
}
}
}
}
@@ -1 +0,0 @@
{"events":[{"eventState":{},"tournament":{"name":"FIFA World Cup, Group B","slug":"world-championship-gr-b","category":{"name":"World","slug":"world","sport":{"name":"Football","slug":"football","id":1},"priority":20,"country":{},"id":1468,"flag":"international","fieldTranslations":{"nameTranslation":{"ar":"\u0627\u0644\u0639\u0627\u0644\u0645","hi":"\u0935\u093f\u0936\u094d\u0935","bn":"\u09ac\u09bf\u09b6\u09cd\u09ac","ru":"\u041c\u0438\u0440"},"shortNameTranslation":{}}},"uniqueTournament":{"name":"FIFA World Cup","slug":"world-championship","primaryColorHex":"#d20a11","secondaryColorHex":"#e8bb57","category":{"name":"World","slug":"world","sport":{"name":"Football","slug":"football","id":1},"priority":20,"country":{},"id":1468,"flag":"international","fieldTranslations":{"nameTranslation":{"ar":"\u0627\u0644\u0639\u0627\u0644\u0645","hi":"\u0935\u093f\u0936\u094d\u0935","bn":"\u09ac\u09bf\u09b6\u09cd\u09ac","ru":"\u041c\u0438\u0440"},"shortNameTranslation":{}}},"userCount":1344736,"hasPerformanceGraphFeature":false,"country":{},"id":16,"hasEventPlayerStatistics":true,"displayInverseHomeAwayTeams":false,"fieldTranslations":{"nameTranslation":{"pt-pt":"Mundial","ar":"\u0643\u0623\u0633 \u0627\u0644\u0639\u0627\u0644\u0645","bn":"\u0993\u09af\u09bc\u09be\u09b0\u09cd\u09b2\u09cd\u09a1 \u099a\u09cd\u09af\u09be\u09ae\u09cd\u09aa\u09bf\u09af\u09bc\u09a8\u09b6\u09bf\u09aa","hi":"\u0935\u0930\u094d\u0932\u094d\u0921 \u091a\u0948\u0902\u092a\u093f\u092f\u0928\u0936\u093f\u092a","hr":"FIFA Svjetsko prvenstvo","az":"F\u0130FA D\u00fcnya Kuboku","nl":"Wereldkampioenschap","fr":"Coupe du monde","de":"Weltmeisterschaft","el":"\u03a0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf \u039a\u03cd\u03c0\u03b5\u03bb\u03bb\u03bf","hu":"FIFA Vil\u00e1gbajnoks\u00e1g","id":"Piala Dunia FIFA","it":"Coppa del Mondo FIFA","ja":"FIFA\u30ef\u30fc\u30eb\u30c9\u30ab\u30c3\u30d7","ko":"FIFA \uc6d4\ub4dc\ucef5","no":"Verdensmesterskapet","pl":"Mistrzostwa \u015awiata","pt":"Copa do Mundo FIFA","ro":"Campionatul Mondial","es":"Copa Mundial","es-la":"Copa Mundial","sv":"V\u00e4rldsm\u00e4sterskapet","th":"\u0e1f\u0e38\u0e15\u0e1a\u0e2d\u0e25\u0e42\u0e25\u0e01","tr":"FIFA D\u00fcnya Kupas\u0131","vi":"Gi\u1ea3i V\u00f4 \u0110\u1ecbch Th\u1ebf Gi\u1edbi","ru":"\u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430","sr":"\u0421\u0432\u0435\u0442\u0441\u043a\u043e \u043f\u0440\u0432\u0435\u043d\u0441\u0442\u0432\u043e"},"shortNameTranslation":{}}},"priority":812,"isGroup":true,"groupName":"Group B","groupSign":"B","isLive":false,"id":3955,"fieldTranslations":{"nameTranslation":{"ar":"\u0628\u0637\u0648\u0644\u0629 \u0627\u0644\u0639\u0627\u0644\u0645\u060c \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629 B","bn":"\u0993\u09af\u09bc\u09be\u09b0\u09cd\u09b2\u09cd\u09a1 \u099a\u09cd\u09af\u09be\u09ae\u09cd\u09aa\u09bf\u09af\u09bc\u09a8\u09b6\u09bf\u09aa, \u0997\u09cd\u09b0. \u09ac\u09bf","hr":"FIFA Svjetsko prvenstvo, Grupa B","az":"F\u0130FA D\u00fcnya Kuboku, Qrup B","nl":"Wereldkampioenschap, Groep B","fr":"Coupe du monde, Groupe B","de":"Weltmeisterschaft, Gruppe B","el":"\u03a0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf \u039a\u03cd\u03c0\u03b5\u03bb\u03bb\u03bf, \u038c\u03bc\u03b9\u03bb\u03bf\u03c2 B","hu":"Vil\u00e1gbajnoks\u00e1g, Csoport B","id":"Piala Dunia FIFA, Grup B","it":"Coppa del Mondo, Gruppo B","ja":"FIFA\u30ef\u30fc\u30eb\u30c9\u30ab\u30c3\u30d7, \u30b0\u30eb\u30fc\u30d7B","ko":"FIFA \uc6d4\ub4dc\ucef5, \uadf8\ub8f9 B","no":"Verdensmesterskapet, Gruppe B","pl":"Mistrzostwa \u015awiata, Grupa B","pt":"Copa do Mundo FIFA, Grupo B","ro":"Campionatul Mondial, Grupa B","es":"Copa Mundial, Grupo B","es-la":"Copa Mundial, Grupo B","pt-pt":"Mundial, Grupo B","ru":"\u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430, \u0413\u0440\u0443\u043f\u043f\u0430 B","hi":"\u0935\u0930\u094d\u0932\u094d\u0921 \u091a\u0948\u0902\u092a\u093f\u092f\u0928\u0936\u093f\u092a, \u0917\u094d\u0930\u0947\u0921 \u092c\u0940","sv":"V\u00e4rldsm\u00e4sterskapet, Grupp B","th":"\u0e1f\u0e38\u0e15\u0e1a\u0e2d\u0e25\u0e42\u0e25\u0e01, \u0e01\u0e25\u0e38\u0e48\u0e21 B","tr":"FIFA D\u00fcnya Kupas\u0131, Grup B","vi":"Gi\u1ea3i V\u00f4 \u0110\u1ecbch Th\u1ebf Gi\u1edbi, B\u1ea3ng B","sr":"\u0421\u0432\u0435\u0442\u0441\u043a\u043e \u043f\u0440\u0432\u0435\u043d\u0441\u0442\u0432\u043e, \u0413\u0440\u0443\u043f\u0430 \u0411"},"shortNameTranslation":{}}},"season":{"name":"World Cup 2026","year":"2026","editor":false,"seasonCoverageInfo":{},"id":58210},"roundInfo":{"round":1},"customId":"EObscVb","status":{"code":100,"description":"Ended","type":"finished"},"winnerCode":3,"homeTeam":{"name":"Canada","slug":"canada","shortName":"Canada","gender":"M","sport":{"name":"Football","slug":"football","id":1},"userCount":131198,"nameCode":"CAN","ranking":30,"disabled":false,"national":true,"type":0,"country":{"alpha2":"CA","alpha3":"CAN","name":"Canada","slug":"canada"},"id":4752,"subTeams":[],"teamColors":{"primary"Line truncated
@@ -1,14 +0,0 @@
* Get basic list of league_id for all days in 2026-06
https://www.sofascore.com/api/v1/calendar/2026-06/7200/football/unique-tournaments
* with an ID and the date get all scheduled events for this day
* almost all infos are in this link
https://www.sofascore.com/api/v1/unique-tournament/152/scheduled-events/2026-06-01
* Odds for events get ID from previouse link
https://www.sofascore.com/api/v1/event/15235580/odds/1/all
* All player info in dis link
https://www.sofascore.com/api/v1/event/15235580/lineups
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1 +0,0 @@
{"scheduled":[{"tournament":{"name":"FIFA World Cup, Group B","slug":"world-championship-gr-b","category":{"name":"World","slug":"world","sport":{"name":"Football","slug":"football","id":1},"priority":20,"id":1468,"flag":"international","fieldTranslations":{"nameTranslation":{"ar":"\u0627\u0644\u0639\u0627\u0644\u0645","bn":"\u09ac\u09bf\u09b6\u09cd\u09ac","hi":"\u0935\u093f\u0936\u094d\u0935","ru":"\u041c\u0438\u0440"},"shortNameTranslation":{}}},"uniqueTournament":{"name":"FIFA World Cup","slug":"world-championship","category":{"name":"World","slug":"world","sport":{"name":"Football","slug":"football","id":1},"priority":20,"id":1468,"flag":"international","fieldTranslations":{"nameTranslation":{"ar":"\u0627\u0644\u0639\u0627\u0644\u0645","bn":"\u09ac\u09bf\u09b6\u09cd\u09ac","hi":"\u0935\u093f\u0936\u094d\u0935","ru":"\u041c\u0438\u0440"},"shortNameTranslation":{}}},"userCount":1344736,"hasPerformanceGraphFeature":false,"id":16,"hasEventPlayerStatistics":true,"displayInverseHomeAwayTeams":false,"fieldTranslations":{"nameTranslation":{"ar":"\u0643\u0623\u0633 \u0627\u0644\u0639\u0627\u0644\u0645","az":"F\u0130FA D\u00fcnya Kuboku","bn":"\u0993\u09af\u09bc\u09be\u09b0\u09cd\u09b2\u09cd\u09a1 \u099a\u09cd\u09af\u09be\u09ae\u09cd\u09aa\u09bf\u09af\u09bc\u09a8\u09b6\u09bf\u09aa","de":"Weltmeisterschaft","el":"\u03a0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf \u039a\u03cd\u03c0\u03b5\u03bb\u03bb\u03bf","es":"Copa Mundial","es-la":"Copa Mundial","fr":"Coupe du monde","hi":"\u0935\u0930\u094d\u0932\u094d\u0921 \u091a\u0948\u0902\u092a\u093f\u092f\u0928\u0936\u093f\u092a","hr":"FIFA Svjetsko prvenstvo","hu":"FIFA Vil\u00e1gbajnoks\u00e1g","id":"Piala Dunia FIFA","it":"Coppa del Mondo FIFA","ja":"FIFA\u30ef\u30fc\u30eb\u30c9\u30ab\u30c3\u30d7","ko":"FIFA \uc6d4\ub4dc\ucef5","nl":"Wereldkampioenschap","no":"Verdensmesterskapet","pl":"Mistrzostwa \u015awiata","pt":"Copa do Mundo FIFA","pt-pt":"Mundial","ro":"Campionatul Mondial","ru":"\u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430","sr":"\u0421\u0432\u0435\u0442\u0441\u043a\u043e \u043f\u0440\u0432\u0435\u043d\u0441\u0442\u0432\u043e","sv":"V\u00e4rldsm\u00e4sterskapet","th":"\u0e1f\u0e38\u0e15\u0e1a\u0e2d\u0e25\u0e42\u0e25\u0e01","tr":"FIFA D\u00fcnya Kupas\u0131","vi":"Gi\u1ea3i V\u00f4 \u0110\u1ecbch Th\u1ebf Gi\u1edbi"},"shortNameTranslation":{}}},"priority":812,"groupSign":"B","id":3955,"fieldTranslations":{"nameTranslation":{"ar":"\u0628\u0637\u0648\u0644\u0629 \u0627\u0644\u0639\u0627\u0644\u0645\u060c \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629 B","bn":"\u0993\u09af\u09bc\u09be\u09b0\u09cd\u09b2\u09cd\u09a1 \u099a\u09cd\u09af\u09be\u09ae\u09cd\u09aa\u09bf\u09af\u09bc\u09a8\u09b6\u09bf\u09aa, \u0997\u09cd\u09b0. \u09ac\u09bf","hr":"FIFA Svjetsko prvenstvo, Grupa B","az":"F\u0130FA D\u00fcnya Kuboku, Qrup B","nl":"Wereldkampioenschap, Groep B","fr":"Coupe du monde, Groupe B","de":"Weltmeisterschaft, Gruppe B","el":"\u03a0\u03b1\u03b3\u03ba\u03cc\u03c3\u03bc\u03b9\u03bf \u039a\u03cd\u03c0\u03b5\u03bb\u03bb\u03bf, \u038c\u03bc\u03b9\u03bb\u03bf\u03c2 B","hu":"Vil\u00e1gbajnoks\u00e1g, Csoport B","id":"Piala Dunia FIFA, Grup B","it":"Coppa del Mondo, Gruppo B","ja":"FIFA\u30ef\u30fc\u30eb\u30c9\u30ab\u30c3\u30d7, \u30b0\u30eb\u30fc\u30d7B","ko":"FIFA \uc6d4\ub4dc\ucef5, \uadf8\ub8f9 B","no":"Verdensmesterskapet, Gruppe B","pl":"Mistrzostwa \u015awiata, Grupa B","pt":"Copa do Mundo FIFA, Grupo B","ro":"Campionatul Mondial, Grupa B","es":"Copa Mundial, Grupo B","es-la":"Copa Mundial, Grupo B","pt-pt":"Mundial, Grupo B","ru":"\u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430, \u0413\u0440\u0443\u043f\u043f\u0430 B","hi":"\u0935\u0930\u094d\u0932\u094d\u0921 \u091a\u0948\u0902\u092a\u093f\u092f\u0928\u0936\u093f\u092a, \u0917\u094d\u0930\u0947\u0921 \u092c\u0940","sv":"V\u00e4rldsm\u00e4sterskapet, Grupp B","th":"\u0e1f\u0e38\u0e15\u0e1a\u0e2d\u0e25\u0e42\u0e25\u0e01, \u0e01\u0e25\u0e38\u0e48\u0e21 B","tr":"FIFA D\u00fcnya Kupas\u0131, Grup B","vi":"Gi\u1ea3i V\u00f4 \u0110\u1ecbch Th\u1ebf Gi\u1edbi, B\u1ea3ng B","sr":"\u0421\u0432\u0435\u0442\u0441\u043a\u043e \u043f\u0440\u0432\u0435\u043d\u0441\u0442\u0432\u043e, \u0413\u0440\u0443\u043f\u0430 \u0411"},"shortNameTranslation":{}}},"timezoneEventCount":{"-43200":1,"-39600":1,"-36000":1,"-34200":1,"-32400":1,"-28800":1,"-25200":1,"-21600":1,"-18000":1,"-16200":1,"-14400":1,"-12600":1,"-10800":1,"-9000":1,"-7200":1,"-3600":1,"0":1,"3600":1,"7200":1,"10800":1,"12600":1,"14400":1,"16200":1,"18000":1,"19800":1,"20700":1,"21600":1,"23400":1,"25200":1,"28800":1,"30600":1,"31500":1,"32400":1,"34200":1,"36000":1,"37800":1,"39600":1,"43200":1,"45900":1,"46800":1,"49500":1,"50400":1}},{"tournament":{"name":"FIFA World Cup, Group C","slug":"world-championship-gr-c","category":{"name":"World","slug":"world","sport":{"name":"Football","slug":"football","id":1},"priority":20,"id":1468,"flag":"international","fieldTranslations":{"nameTranslation":{"ar":"\u062Line truncated
+11 -8
View File
@@ -23,7 +23,7 @@ class Nuh extends Command
public static $id = 0; public static $id = 0;
protected $signature = 'nuh {process=help} {--truncate} {--grps=0} {--days=0} {--day=0} {--id=0} {--prc=0} {--fn=} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}'; protected $signature = 'nuh {process=help} {--truncate} {--grps=0} {--days=0} {--day=0} {--id=0} {--run=0} {--fn=} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}';
public function handle() public function handle()
{ {
@@ -45,14 +45,17 @@ class Nuh extends Command
$txt .= '--gid=groupid (optional) [bkms, groupid]' . PHP_EOL; $txt .= '--gid=groupid (optional) [bkms, groupid]' . PHP_EOL;
$txt .= '--truncate (optional)' . PHP_EOL; $txt .= '--truncate (optional)' . PHP_EOL;
$txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL;
$txt .= 'Sofascore' . PHP_EOL; $txt .= 'Sofascore (67)' . PHP_EOL;
$txt .= '-----------------------------------------------------------' . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL;
$txt .= '--day (optional) grap day format "Y-m-d" or --t for today' . PHP_EOL; $txt .= '--run=[1,2,3,4,5,6,7]'
$txt .= '--days (optional) grap days back from yesterday' . PHP_EOL; .PHP_EOL.chr(9).'1) player/season'
$txt .= '--grps (optional) csv of tournament_id\'s' . PHP_EOL; .PHP_EOL.chr(9).'2) setting to local'
$txt .= '--l langsam: calls between 0.5 an 10 sec' . PHP_EOL; .PHP_EOL.chr(9).'3) create zip'
$txt .= '--p will print days and tournaments and stop' . PHP_EOL; .PHP_EOL.chr(9).'4) mail folder'
$txt .= '--prc (generate data) [1 => count played/season, 2=>Tournamet to local]' . PHP_EOL; .PHP_EOL.chr(9).'5) grap tornaments/day'
.PHP_EOL.chr(9).'6) run grapper'
.PHP_EOL.chr(9).'7) update task'
.PHP_EOL;
$txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL;
$txt .= 'Options' . PHP_EOL; $txt .= 'Options' . PHP_EOL;
$txt .= '-----------------------------------------------------------' . PHP_EOL; $txt .= '-----------------------------------------------------------' . PHP_EOL;
@@ -52,7 +52,7 @@ class SupervisorsTable
SelectColumn::make('name') SelectColumn::make('name')
->selectablePlaceholder(true) ->selectablePlaceholder(true)
->hidden(function (ListSupervisors $livewire) { ->hidden(function (ListSupervisors $livewire) {
return $livewire->tableFilters['provider_id']['value'] == 8; return (bool) in_array($livewire->tableFilters['provider_id']['value'], [8,12]);
}) })
->options(function ($record) { ->options(function ($record) {
switch ($record->provider_id) { switch ($record->provider_id) {
@@ -116,7 +116,7 @@ class SupervisorsTable
}), }),
SelectColumn::make('sport_id') SelectColumn::make('sport_id')
->hidden(function (ListSupervisors $livewire) { ->hidden(function (ListSupervisors $livewire) {
return in_array($livewire->tableFilters['provider_id']['value'], [11]); return in_array($livewire->tableFilters['provider_id']['value'], [11, 12]);
}) })
->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id')) ->options(fn () => Sport::where('is_active', 1)->pluck('name', 'id'))
->placeholder('All'), ->placeholder('All'),
@@ -182,6 +182,7 @@ class SupervisorsTable
]) ])
->filters([ ->filters([
SelectFilter::make('provider_id') SelectFilter::make('provider_id')
->selectablePlaceholder(false)
->relationship('provider', 'name') ->relationship('provider', 'name')
->label('Provider'), ->label('Provider'),
SelectFilter::make('sport_id') SelectFilter::make('sport_id')
@@ -5,6 +5,7 @@ namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Schemas;
use App\Models\Sport; use App\Models\Sport;
use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
@@ -15,6 +16,8 @@ class SofaScoreTaskForm
return $schema return $schema
->columns(1) ->columns(1)
->components([ ->components([
TextInput::make('name')
->required(),
Select::make('sport_id') Select::make('sport_id')
->default(1) ->default(1)
->selectablePlaceholder(false) ->selectablePlaceholder(false)
@@ -19,6 +19,8 @@ class SofaScoreTasksTable
{ {
return $table return $table
->columns([ ->columns([
TextColumn::make('id')->badge()->alignCenter()->width('1rem'),
TextColumn::make('name'),
IconColumn::make('sport.icon') IconColumn::make('sport.icon')
->label('') ->label('')
->grow(false) ->grow(false)
+42 -13
View File
@@ -8,43 +8,72 @@ case "$1" in
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
echo "\n⚽ copy active tournaments" echo "\n⚽ copy active tournaments"
php artisan nuh --d --f 73 --prc=2 php artisan nuh --d --f 67 --run=2 --task=1
echo "\n⚽ close tunnel" echo "\n⚽ close tunnel"
killall ssh killall ssh
echo "\n⚽ grap avilable tournaments for given days" echo "\n⚽ grap avilable tournaments for given days"
php artisan nuh --d --f 73 --prc=5 php artisan nuh --d --f 67 --run=5 --task=1
echo "\n⚽ grapp data sofascore" echo "\n⚽ grapp data sofascore"
php artisan nuh --d --f 72 php artisan nuh --d --f 67 --run=6 --task=1
echo "\n⚽ create zip archive" echo "\n⚽ create zip archive"
php artisan nuh --d --f 73 --prc=3 php artisan nuh --d --f 67 --run=3 --task=1
echo "\n⚽ mail archive" echo "\n⚽ mail archive"
php artisan nuh --d --f 73 --prc=4 php artisan nuh --d --f 67 --run=4 --task=1
echo "\n😎 done :)" echo "\n😎 done :)"
;; ;;
"2") "2")
# AUTO GRAPPER SOFASCORE (production no debug and slow) # AUTO GRAPPER SOFASCORE (production no debug and 10s breaks)
killall ssh killall ssh
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
php artisan nuh --f 73 --prc=2 php artisan nuh --f 67 --run=2 --task=1
killall ssh killall ssh
php artisan nuh --f 73 --prc=5 php artisan nuh --f 67 --run=5 --task=1
php artisan nuh --f 72 php artisan nuh --f 67 --run=6 --task=1
php artisan nuh --f 73 --prc=3 php artisan nuh --f 67 --run=3 --task=1
php artisan nuh --f 73 --prc=4 php artisan nuh --f 67 --run=4 --task=1
;;
"3")
# AUTO GRAPPER SOFASCORE (debug)
echo "\n⚽ close all open vpn"
killall ssh
echo "\n⚽ open vpn tunnel to prod"
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
echo "\n⚽ copy active tournaments"
php artisan nuh --d --f 67 --run=2 --task=2
echo "\n⚽ close tunnel"
killall ssh
echo "\n⚽ grap avilable tournaments for given days"
php artisan nuh --d --f 67 --run=5 --task=2
echo "\n⚽ grapp data sofascore"
php artisan nuh --d --f 67 --run=6 --task=2
echo "\n⚽ create zip archive"
php artisan nuh --d --f 67 --run=3 --task=2
echo "\n⚽ mail archive"
php artisan nuh --d --f 67 --run=4 --task=2
echo "\n😎 done :)"
;; ;;
*) *)
echo "" echo ""
echo "--------------------------" echo "--------------------------"
echo "apple damon grapper sofascore" echo "apple damon grapper sofascore"
echo "--------------------------" echo "--------------------------"
echo "1 => debug runs faster and echos notices" echo "1 => debug max 5sec intervals | print notes | yesterday | soccer task_id:1"
echo "2 => for production no notices" echo "2 => prod max 10sec intervals | no notes | yesterday | soccer | task_id:1"
echo "3 => debug max 5sec intervals | print notes | manual dates or range | soccer | task_id:2"
echo "--------------------------" echo "--------------------------"
echo "" echo ""
;; ;;
Binary file not shown.
Binary file not shown.