wip sofascore
This commit is contained in:
1 parent
7aa3c90344
commit
6a9173e3eb
6 files changed
+69
-48
No files matched your search
@@ -51,9 +51,9 @@ class Sofascore
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['sport'] . ' ' . Nuh::$options['name'], 'b');
|
||||
Notice::note(Nuh::$options['sport'] . ' ' . Nuh::$options['name'], 'bb');
|
||||
}
|
||||
|
||||
|
||||
switch (Nuh::$options['name']) {
|
||||
case 'TOURNAMENTS':
|
||||
Tournament::load();
|
||||
|
||||
@@ -16,7 +16,8 @@ class Events
|
||||
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;
|
||||
@@ -24,15 +25,34 @@ class Events
|
||||
$dback = 1;
|
||||
}
|
||||
|
||||
$force = Nuh::$options['f'] ?? 0;
|
||||
|
||||
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;
|
||||
|
||||
$sport_id = Nuh::$options['sport_id'];
|
||||
|
||||
// for ($i = 1; $i <= $dback; $i++) {
|
||||
// // remove one day to start yesterday
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Country;
|
||||
use App\Models\SofaScoreCategorie;
|
||||
@@ -179,7 +177,9 @@ class Tournament
|
||||
]);
|
||||
}
|
||||
|
||||
Notice::note("tournaments: $tournaments_counter", 'p');
|
||||
if ($debug) {
|
||||
Notice::note("tournaments: $tournaments_counter", 'p');
|
||||
}
|
||||
|
||||
SofaScoreDay::updateOrCreate(['day' => $day], [$sport->ss_slug => 1]);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ class Nuh extends Command
|
||||
$txt .= '--day (optional) grap day format "Y-m-d" or --t for today' . PHP_EOL;
|
||||
$txt .= '--days (optional) grap days back from yesterday' . PHP_EOL;
|
||||
$txt .= '--groups (optional) csv of tournament_id\'s' . PHP_EOL;
|
||||
$txt .= '--p will print days and tournaments and stop' . PHP_EOL;
|
||||
$txt .= '-----------------------------------------------------------' . PHP_EOL . PHP_EOL;
|
||||
$txt .= 'Options' . PHP_EOL;
|
||||
$txt .= '-----------------------------------------------------------' . PHP_EOL;
|
||||
|
||||
Reference in new issue
Block a user