fix select country
This commit is contained in:
1 parent
cda3acc1a5
commit
cbc66d7e27
3 files changed
+29
-34
No files matched your search
@@ -14,22 +14,12 @@ class LoadSofaScoreCategory
|
|||||||
->groupBy('league_id')
|
->groupBy('league_id')
|
||||||
->pluck('league_id')->toArray();
|
->pluck('league_id')->toArray();
|
||||||
|
|
||||||
/*
|
$res = SofaScoreTournament::with('sofascore_category')->whereIn('tournament_id', $league_ids)->get();
|
||||||
0 => 24
|
|
||||||
1 => 25
|
|
||||||
2 => 54
|
|
||||||
3 => 131
|
|
||||||
4 => 192
|
|
||||||
5 => 242
|
|
||||||
6 => 406
|
|
||||||
7 => 11539
|
|
||||||
8 => 11621
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sofa_score_category_id = SofaScoreTournament::whereIn('tournament_id', $league_ids)->pluck('sofa_score_category_id')->toArray();
|
$arr = [];
|
||||||
|
foreach ($res as $value) {
|
||||||
$sofa_score_category_id = array_unique($sofa_score_category_id);
|
$arr[$value->sofa_score_category_id] = $value->sofascore_category->name;
|
||||||
|
}
|
||||||
return SofaScoreCategory::where('in_soccer', 1)->whereIn('id', $sofa_score_category_id)->orderBy('name')->pluck('name', 'id');
|
return $arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,10 +117,11 @@ trait GrapSofascore
|
|||||||
|
|
||||||
$this->load_tournaments_requested($folder);
|
$this->load_tournaments_requested($folder);
|
||||||
|
|
||||||
|
$this->clear_folder($folder, 'all');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* day 1
|
* day 1
|
||||||
*/
|
*/
|
||||||
$this->clear_folder($folder, 'all');
|
|
||||||
|
|
||||||
$day = Carbon::now()->subDay()->format('Y-m-d');
|
$day = Carbon::now()->subDay()->format('Y-m-d');
|
||||||
|
|
||||||
@@ -130,12 +131,9 @@ trait GrapSofascore
|
|||||||
$this->get_event($day, $tournament);
|
$this->get_event($day, $tournament);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->import_to_excel($folder, $day);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* day 5
|
* day 5
|
||||||
*/
|
*/
|
||||||
$this->clear_folder($folder, 'data');
|
|
||||||
|
|
||||||
$day = Carbon::now()->subDays(5)->format('Y-m-d');
|
$day = Carbon::now()->subDays(5)->format('Y-m-d');
|
||||||
|
|
||||||
@@ -145,7 +143,15 @@ trait GrapSofascore
|
|||||||
$this->get_event($day, $tournament);
|
$this->get_event($day, $tournament);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->import_to_excel($folder, $day);
|
/**
|
||||||
|
* to excel day by day
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->import_to_excel($folder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mail it
|
||||||
|
*/
|
||||||
|
|
||||||
$this->send($folder);
|
$this->send($folder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Models\SofaScoreTask;
|
|||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
trait GrappingToExcel
|
trait GrappingToExcel
|
||||||
{
|
{
|
||||||
@@ -13,28 +14,25 @@ trait GrappingToExcel
|
|||||||
|
|
||||||
protected string $titel = '';
|
protected string $titel = '';
|
||||||
|
|
||||||
public function import_to_excel(string $folder, $day = '')
|
public function import_to_excel(string $folder)
|
||||||
{
|
{
|
||||||
ini_set('memory_limit', -1);
|
ini_set('memory_limit', -1);
|
||||||
|
|
||||||
if ($this->debug) {
|
if ($this->debug) {
|
||||||
Notice::note("import $folder to excel", 'g');
|
Notice::note("Import to Excel", 'bb');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->task_id) {
|
$directories = File::directories($this->data_dir . '/' . $folder);
|
||||||
case 1:
|
|
||||||
$this->titel = ucfirst($folder) . '_' . $day;
|
|
||||||
|
|
||||||
$files = $this->get_tree($this->data_dir . '/' . $day);
|
foreach ($directories as $directory) {
|
||||||
|
|
||||||
break;
|
$day = substr(strrchr($directory, "/"), 1);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$this->titel = ucfirst($folder) . '-' . $day;
|
||||||
|
|
||||||
|
$files = $this->get_tree($directory);
|
||||||
|
|
||||||
|
// only json max 2000
|
||||||
$files = array_chunk($this->filter($files), $this->max);
|
$files = array_chunk($this->filter($files), $this->max);
|
||||||
|
|
||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
@@ -82,6 +80,7 @@ trait GrappingToExcel
|
|||||||
$writer->save("$this->data_dir/$this->titel-$count_from-$count_to.xlsx");
|
$writer->save("$this->data_dir/$this->titel-$count_from-$count_to.xlsx");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function filter(array $files, array $types = ['json'])
|
protected function filter(array $files, array $types = ['json'])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user