wip
This commit is contained in:
1 parent
b5bfda4511
commit
4e460fba49
6 files changed
+84
-38
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore\Grapper;
|
||||
use App\Console\Commands\Grapper\Sofascore\GrapperTest;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ClearDir;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\SetStorage;
|
||||
use App\Console\Commands\Grapper\Sofascore\MakeExcel;
|
||||
use App\Console\Commands\Grapper\Sofascore\Rose;
|
||||
@@ -37,28 +38,28 @@ class Grap extends Command
|
||||
self::$options['base_url'] = 'https://www.sofascore.com/';
|
||||
|
||||
if (! self::$options['id']) {
|
||||
$txt = 'PARAMETERS'.PHP_EOL;
|
||||
$txt .= '--d debug'.PHP_EOL;
|
||||
$txt .= '--r restart range'.PHP_EOL;
|
||||
$txt .= '--f force'.PHP_EOL;
|
||||
$txt .= '--m mail only'.PHP_EOL;
|
||||
$txt .= '--R read file'.PHP_EOL;
|
||||
$txt .= '--S save to file'.PHP_EOL;
|
||||
$txt .= '--folder'.PHP_EOL;
|
||||
$txt .= '-----------------------------------------------------------'.PHP_EOL;
|
||||
$txt .= 'FUNCTION'.PHP_EOL;
|
||||
$txt .= ' 1 grapper DAILY & subDays ( default 3)'.PHP_EOL;
|
||||
$txt .= ' 2 grapper DATE'.PHP_EOL;
|
||||
$txt .= ' 3 grapper RANGE'.PHP_EOL;
|
||||
$txt .= ' 4 grapper ROSE'.PHP_EOL;
|
||||
$txt .= ' 5 import to excel from folder'.PHP_EOL;
|
||||
$txt .= ' 7 settings to local'.PHP_EOL;
|
||||
$txt .= ' 11 move SQL'.PHP_EOL;
|
||||
$txt .= ' 12 testing url for grapping'.PHP_EOL;
|
||||
$txt = 'PARAMETERS' . PHP_EOL;
|
||||
$txt .= '--d debug' . PHP_EOL;
|
||||
$txt .= '--r restart range' . PHP_EOL;
|
||||
$txt .= '--f force' . PHP_EOL;
|
||||
$txt .= '--m mail only' . PHP_EOL;
|
||||
$txt .= '--R read file' . PHP_EOL;
|
||||
$txt .= '--S save to file' . PHP_EOL;
|
||||
$txt .= '--folder' . PHP_EOL;
|
||||
$txt .= '-----------------------------------------------------------' . PHP_EOL;
|
||||
$txt .= 'FUNCTION' . PHP_EOL;
|
||||
$txt .= ' 1 grapper DAILY & subDays ( default 3)' . PHP_EOL;
|
||||
$txt .= ' 2 grapper LAST 3 DAYS' . PHP_EOL;
|
||||
$txt .= ' 3 grapper RANGE' . PHP_EOL;
|
||||
$txt .= ' 4 grapper ROSE' . PHP_EOL;
|
||||
$txt .= ' 5 import to excel from folder' . PHP_EOL;
|
||||
$txt .= ' 7 settings to local' . PHP_EOL;
|
||||
$txt .= ' 11 move SQL' . PHP_EOL;
|
||||
$txt .= ' 12 testing url for grapping' . PHP_EOL;
|
||||
Notice::note($txt, 'b', 1);
|
||||
}
|
||||
|
||||
Notice::note('Task Id '.self::$options['id'], 'gb');
|
||||
Notice::note('Task Id ' . self::$options['id'], 'gb');
|
||||
|
||||
switch (self::$options['id']) {
|
||||
|
||||
@@ -77,10 +78,17 @@ class Grap extends Command
|
||||
|
||||
break;
|
||||
case 2:
|
||||
// DATE
|
||||
// LAST 3 DAYS
|
||||
SetStorage::set(2);
|
||||
|
||||
ClearDir::clear();
|
||||
|
||||
Grapper::load(2);
|
||||
|
||||
MakeExcel::create();
|
||||
|
||||
SendMail::run(1);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
// RANGE
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class BoxNames
|
||||
17 => 'DM',
|
||||
18 => 'MC',
|
||||
19 => 'AM',
|
||||
20 => 'SM',
|
||||
20 => 'SS',
|
||||
21 => 'ST',
|
||||
23 => 'DC',
|
||||
24 => 'DM',
|
||||
|
||||
@@ -621,44 +621,43 @@ class PlayerPropsDrop extends Widget
|
||||
$final = number_format($result['asp_player_goals'], 3);
|
||||
$results[$key]['finale_tamx_gls'] = $tamx;
|
||||
$results[$key]['finale_calc_gls'] = $final;
|
||||
$this->players[$k]['gls'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['gls'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
|
||||
$tamx = number_format($map[$pos]['crd'], 3);
|
||||
$final = number_format($result['asp_player_cards'], 3);
|
||||
$results[$key]['finale_tamx_crd'] = $tamx;
|
||||
$results[$key]['finale_calc_crd'] = $final;
|
||||
$this->players[$k]['crd'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['crd'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
|
||||
$tamx = number_format($map[$pos]['fls'], 3);
|
||||
$final = number_format($result['asp_player_fouls'], 3);
|
||||
$results[$key]['finale_tamx_fls'] = $tamx;
|
||||
$results[$key]['finale_calc_fls'] = $final;
|
||||
$this->players[$k]['fls'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['fls'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
|
||||
$tamx = number_format($map[$pos]['ofs'], 3);
|
||||
$final = number_format($result['asp_player_offsides'], 3);
|
||||
$results[$key]['finale_tamx_ofs'] = $tamx;
|
||||
$results[$key]['finale_calc_ofs'] = $final;
|
||||
$this->players[$k]['ofs'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['ofs'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
|
||||
$tamx = number_format($map[$pos]['tsh'], 3);
|
||||
$final = number_format($result['asp_player_total_shots'], 3);
|
||||
$results[$key]['finale_tamx_tsh'] = $tamx;
|
||||
$results[$key]['finale_calc_tsh'] = $final;
|
||||
$this->players[$k]['tsh'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['tsh'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
|
||||
$tamx = number_format($map[$pos]['snt'], 3);
|
||||
$final = number_format($result['asp_player_shots_on_target'], 3);
|
||||
$results[$key]['finale_tamx_snt'] = $tamx;
|
||||
$results[$key]['finale_calc_snt'] = $final;
|
||||
$this->players[$k]['snt'] = $final > $tamx ? $final : $tamx;
|
||||
$this->players[$k]['snt'] = (float) $final > (float) $tamx ? $final : $tamx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->calculationVariables = $results;
|
||||
|
||||
|
||||
$this->dispatch('update-players', players: $this->players);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user