From eb4499efe5d6f992662fa703f9c38c6b343efdc6 Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 28 Sep 2026 08:19:49 +0200 Subject: [PATCH] wip --- app/Traits/Sofascore/GrapSofascore.php | 6 ++---- app/Traits/Sofascore/GrappingHelper.php | 10 +++------- app/Traits/Sofascore/GrappingMail.php | 4 ++-- app/Traits/Sofascore/GrappingToExcel.php | 23 ++++++++++++++--------- notes/WORK.md | 1 + 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/Traits/Sofascore/GrapSofascore.php b/app/Traits/Sofascore/GrapSofascore.php index 7b8f9154..83c18333 100644 --- a/app/Traits/Sofascore/GrapSofascore.php +++ b/app/Traits/Sofascore/GrapSofascore.php @@ -135,7 +135,7 @@ trait GrapSofascore /** * day 5 */ - // $this->clear_folder($folder, 'data'); + $this->clear_folder($folder, 'data'); $day = Carbon::now()->subDays(5)->format('Y-m-d'); @@ -214,9 +214,7 @@ trait GrapSofascore } } - Notice::note('Excel', 'g'); - - $this->import_to_excel($folder, $day); + $this->import_to_excel($folder); Notice::note('Done', 'g'); } diff --git a/app/Traits/Sofascore/GrappingHelper.php b/app/Traits/Sofascore/GrappingHelper.php index 4db70d71..0bef1786 100644 --- a/app/Traits/Sofascore/GrappingHelper.php +++ b/app/Traits/Sofascore/GrappingHelper.php @@ -216,13 +216,9 @@ trait GrappingHelper } /** - * a Grap --d --f 67 --fun=4 --task=1 + * Summary of grap_tournaments_for_day * - * Ita Serie-A-Saison 23-08-2025 - 24-05-2026 - * Ger Bundesliga 22-08-2025 – 16-05-2026 - * Eng Premier league 15-08-2025 - 24-05-2026 - * Spa La Liga 15-08-2025 - 24-05-2026 - * Fra Liggue 15-08-2025 - 17-05-2026 + * @return void */ protected function grap_tournaments_for_day(string $day) { @@ -248,7 +244,7 @@ trait GrappingHelper while ($page) { // $data = $this->curl($url); - $this->sleep(1); + $this->sleep(); $url = $this->base_url."api/v1/sport/$slug/scheduled-tournaments/$day/page/$page"; diff --git a/app/Traits/Sofascore/GrappingMail.php b/app/Traits/Sofascore/GrappingMail.php index d06f0eca..295c9f99 100644 --- a/app/Traits/Sofascore/GrappingMail.php +++ b/app/Traits/Sofascore/GrappingMail.php @@ -14,10 +14,10 @@ trait GrappingMail ini_set('memory_limit', -1); if ($this->debug) { - Notice::note("Eend excel files from folder $folder", 'b'); + Notice::note("Mail Excel: $folder", 'b'); } - $files = $this->get_tree("$this->data_dir/$folder"); + $files = $this->get_tree($this->data_dir); $sendfiles = $this->filter($files, ['xlsx']); diff --git a/app/Traits/Sofascore/GrappingToExcel.php b/app/Traits/Sofascore/GrappingToExcel.php index f8f5bb3e..afeb80e5 100644 --- a/app/Traits/Sofascore/GrappingToExcel.php +++ b/app/Traits/Sofascore/GrappingToExcel.php @@ -2,8 +2,8 @@ namespace App\Traits\Sofascore; +use App\Models\SofaScoreTask; use App\Utilities\Notice; -use Illuminate\Support\Carbon; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -21,14 +21,19 @@ trait GrappingToExcel Notice::note("import $folder to excel", 'g'); } - $this->titel = ucfirst($folder); - if (! $day) { - $this->titel .= '_'.Carbon::now()->format('Y-m-d'); - } else { - $this->titel .= "_$day"; - } + switch ($this->task_id) { + case 1: + $this->titel .= ucfirst($folder).'_'.$day; - $files = $this->get_tree($this->data_dir); + $files = $this->get_tree($this->data_dir.'/'.$day); + + break; + case 3: + $task = SofaScoreTask::with('sport')->where('id', $this->task_id)->first(); + $this->titel = ucfirst($folder).'-'.$this->clean_string($task->name); + $files = $this->get_tree($this->data_dir); + break; + } $files = array_chunk($this->filter($files), $this->max); @@ -74,7 +79,7 @@ trait GrappingToExcel $spreadsheet->setActiveSheetIndex(0); $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->save("$this->data_dir/$folder/$this->titel-$count_from-$count_to.xlsx"); + $writer->save("$this->data_dir/$this->titel-$count_from-$count_to.xlsx"); } } diff --git a/notes/WORK.md b/notes/WORK.md index c9622e82..44810a56 100644 --- a/notes/WORK.md +++ b/notes/WORK.md @@ -2,6 +2,7 @@ 2) DOCKER flarsolver to bypass cloudeflare + # Da Laravel lokal (via Brew) läuft, greift es über localhost auf Docker zu FLARESOLVERR_URL=http://192.168.178