wip
This commit is contained in:
1 parent
b5bfda4511
commit
4e460fba49
6 files changed
+84
-38
No files matched your search
@@ -34,7 +34,18 @@ class Grapper
|
||||
|
||||
$count = 0;
|
||||
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', $task_id)->where('disabled', false)->get();
|
||||
/** take for task 2 the same like for task 1 */
|
||||
switch ($task_id) {
|
||||
case 1:
|
||||
case 2:
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', 1)->where('disabled', false)->get();
|
||||
break;
|
||||
|
||||
default:
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', $task_id)->where('disabled', false)->get();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* daily restart always
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ClearDir
|
||||
{
|
||||
public static function clear(): void
|
||||
{
|
||||
$debug = Grap::$options['d'];
|
||||
|
||||
$file = new Filesystem;
|
||||
|
||||
$file->cleanDirectory(Grap::$storage);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Directory: ' . Grap::$storage . ' - All content cleard', 'p');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ class LoadDays
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
$restart = Grap::$options['r'] ?? 0;
|
||||
$date = Grap::$options['date'] ?? '';
|
||||
|
||||
$dates = [];
|
||||
|
||||
@@ -24,6 +23,7 @@ class LoadDays
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
$task = SofaScoreTask::with('sport')->where('id', $task_id)->first();
|
||||
|
||||
if ($debug) {
|
||||
@@ -36,16 +36,21 @@ class LoadDays
|
||||
$dates[] = ValidateDate::get(Grap::$folder);
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
$dates[] = ValidateDate::get($date);
|
||||
break;
|
||||
|
||||
case 'last3days':
|
||||
case 'range':
|
||||
$from = ValidateDate::get($task->day_from);
|
||||
$to = ValidateDate::get($task->day_to);
|
||||
switch ($task_id) {
|
||||
case 2:
|
||||
$from = Carbon::now()->subDays(3);
|
||||
$to = Carbon::now()->subDays(1);
|
||||
break;
|
||||
|
||||
$from = Carbon::createFromDate($from);
|
||||
$to = Carbon::createFromDate($to);
|
||||
default:
|
||||
$from = ValidateDate::get($task->day_from);
|
||||
$to = ValidateDate::get($task->day_to);
|
||||
$from = Carbon::createFromDate($from);
|
||||
$to = Carbon::createFromDate($to);
|
||||
break;
|
||||
}
|
||||
|
||||
$lengthdates = $from->diffInDays($to);
|
||||
|
||||
|
||||
Reference in new issue
Block a user