wip
This commit is contained in:
1 parent
86115ac9e8
commit
a85ac159de
3 files changed
+31
-36
No files matched your search
@@ -26,7 +26,7 @@ class Sofascore
|
||||
|
||||
public static string $zipfile;
|
||||
|
||||
public static string $excel_name;
|
||||
public static string $folder;
|
||||
|
||||
public static string $useragent = '4';
|
||||
|
||||
@@ -101,8 +101,8 @@ class Sofascore
|
||||
|
||||
switch ($task->id) {
|
||||
case 1:
|
||||
self::$storage = $sofascore_data . $storage_name . '/' . Carbon::now()->subDays(3)->format('Y-m-d');
|
||||
self::$zipfile = $sofascore_data . $storage_name . '/' . Carbon::now()->subDays(3)->format('Y-m-d') . '.zip';
|
||||
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;
|
||||
@@ -122,8 +122,5 @@ class Sofascore
|
||||
self::$zipfile = $sofascore_data . $storage_name . '/archive.zip';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($debug)
|
||||
Notice::note("\nStore:\t" . Sofascore::$storage . "\nZip:\t" . Sofascore::$zipfile, 'c');
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ZipFolder;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
class MakeExcel
|
||||
{
|
||||
public static $FOLDER = 'Season-25-26-Major-Leagues';
|
||||
public static $MAXCOLUMNS = 1000;
|
||||
public static $max = 1000;
|
||||
|
||||
public static function create()
|
||||
{
|
||||
@@ -21,21 +21,17 @@ class MakeExcel
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Make Excel", 'bb');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Folder to Import: " . self::$FOLDER . "\nMaximum in Excel: " . self::$MAXCOLUMNS, 'b');
|
||||
Notice::note("Make Excel folder to import: " . Sofascore::$folder . "\nmaximum files in excel: " . self::$max, 'b');
|
||||
}
|
||||
|
||||
$files = self::load_files();
|
||||
|
||||
foreach ($files as $key => $value) {
|
||||
|
||||
$from = $key * self::$MAXCOLUMNS + 1;
|
||||
$from = $key * self::$max + 1;
|
||||
$key++;
|
||||
$to = $key * self::$MAXCOLUMNS;
|
||||
$filename = self::$FOLDER . '-' . $from . '-' . $to . '.xlsx';
|
||||
$to = $key * self::$max;
|
||||
$filename = Sofascore::$folder . '-' . $from . '-' . $to . '.xlsx';
|
||||
|
||||
$spreadsheet = new Spreadsheet;
|
||||
$spreadsheet->getProperties()->setTitle($filename);
|
||||
@@ -65,7 +61,7 @@ class MakeExcel
|
||||
|
||||
public static function load_files()
|
||||
{
|
||||
$files = ZipFolder::get_tree(Sofascore::$storage . '/' . self::$FOLDER);
|
||||
$files = ZipFolder::get_tree(Sofascore::$storage . '/' . Sofascore::$folder);
|
||||
|
||||
$filtered = [];
|
||||
foreach ($files as $file) {
|
||||
@@ -74,7 +70,6 @@ class MakeExcel
|
||||
$filtered[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
return array_chunk($filtered, self::$MAXCOLUMNS);
|
||||
return array_chunk($filtered, self::$max);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user