wip
This commit is contained in:
1 parent
2b591ad8cf
commit
ad0724f61b
8 files changed
+145
-117
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user