wip
This commit is contained in:
1 parent
f028a8b2a8
commit
60ab054eb2
5 files changed
+18
-16
No files matched your search
@@ -10,13 +10,13 @@ use App\Console\Commands\Grapper\Sofascore\Rose;
|
|||||||
use App\Console\Commands\Grapper\Sofascore\SendMail;
|
use App\Console\Commands\Grapper\Sofascore\SendMail;
|
||||||
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
|
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
|
||||||
use App\Console\Commands\Grapper\Sofascore\SqlMover;
|
use App\Console\Commands\Grapper\Sofascore\SqlMover;
|
||||||
use App\Traits\UpdatePlayerSeasonHelper;
|
use App\Traits\UpdateHelper;
|
||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
class Grap extends Command
|
class Grap extends Command
|
||||||
{
|
{
|
||||||
use UpdatePlayerSeasonHelper;
|
use UpdateHelper;
|
||||||
|
|
||||||
public static $options = [];
|
public static $options = [];
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,21 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Traits\UpdatePlayerSeasonHelper;
|
use App\Traits\UpdateHelper;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
class Upd extends Command
|
class Upd extends Command
|
||||||
{
|
{
|
||||||
use UpdatePlayerSeasonHelper;
|
use UpdateHelper;
|
||||||
|
|
||||||
protected $signature = 'upd {--d}';
|
protected $signature = 'update:player {--d}';
|
||||||
|
|
||||||
protected $description = 'update sofa_score_player_per_seasons';
|
protected $description = 'update sofa_score_player_per_seasons';
|
||||||
|
|
||||||
public function handleUpdate(int $playerCount): void
|
public function handleUpdate(int $playerCount): void
|
||||||
{
|
{
|
||||||
$this->update($playerCount);
|
// Have fun running imports here
|
||||||
|
// Examples can be found in the ImportHelper trait
|
||||||
|
$this->updatePlayers($playerCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,14 +3,14 @@
|
|||||||
namespace App\Filament\Imports\Helper;
|
namespace App\Filament\Imports\Helper;
|
||||||
|
|
||||||
use App\Models\StatistikoDetail;
|
use App\Models\StatistikoDetail;
|
||||||
use App\Traits\UpdatePlayerSeasonHelper;
|
use App\Traits\UpdateHelper;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\LazyCollection;
|
use Illuminate\Support\LazyCollection;
|
||||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||||
|
|
||||||
class ImportDetails
|
class ImportDetails
|
||||||
{
|
{
|
||||||
use UpdatePlayerSeasonHelper;
|
use UpdateHelper;
|
||||||
|
|
||||||
public static function run(string $filePath): void
|
public static function run(string $filePath): void
|
||||||
{
|
{
|
||||||
@@ -64,6 +64,6 @@ class ImportDetails
|
|||||||
StatistikoDetail::where('updated_at', '!=', $now)->update(['is_active' => 0]);
|
StatistikoDetail::where('updated_at', '!=', $now)->update(['is_active' => 0]);
|
||||||
|
|
||||||
/**update statistic player tabel */
|
/**update statistic player tabel */
|
||||||
UpdatePlayerSeasonHelper::update(1000000);
|
UpdateHelper::updatePlayers(1000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
namespace App\Filament\Imports\Helper;
|
namespace App\Filament\Imports\Helper;
|
||||||
|
|
||||||
use App\Models\StatistikoPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
use App\Traits\UpdatePlayerSeasonHelper;
|
use App\Traits\UpdateHelper;
|
||||||
use Illuminate\Support\LazyCollection;
|
use Illuminate\Support\LazyCollection;
|
||||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||||
|
|
||||||
class ImportPlayer
|
class ImportPlayer
|
||||||
{
|
{
|
||||||
use UpdatePlayerSeasonHelper;
|
use UpdateHelper;
|
||||||
|
|
||||||
public static function run(string $filePath): void
|
public static function run(string $filePath): void
|
||||||
{
|
{
|
||||||
@@ -117,6 +117,6 @@ class ImportPlayer
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**update statistic player tabel */
|
/**update statistic player tabel */
|
||||||
UpdatePlayerSeasonHelper::update(1000000);
|
UpdateHelper::updatePlayers(1000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ use PDOStatement;
|
|||||||
|
|
||||||
use function Laravel\Prompts\select;
|
use function Laravel\Prompts\select;
|
||||||
|
|
||||||
trait UpdatePlayerSeasonHelper
|
trait UpdateHelper
|
||||||
{
|
{
|
||||||
protected float $benchmarkStartTime;
|
protected float $benchmarkStartTime;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ trait UpdatePlayerSeasonHelper
|
|||||||
|
|
||||||
protected int $debug;
|
protected int $debug;
|
||||||
|
|
||||||
public function handleUpdate(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@@ -49,7 +49,7 @@ trait UpdatePlayerSeasonHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->update($playerCount);
|
$this->updatePlayers($playerCount);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error(get_class($e).' '.Str::of($e->getMessage())->limit(100)->value());
|
$this->error(get_class($e).' '.Str::of($e->getMessage())->limit(100)->value());
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ trait UpdatePlayerSeasonHelper
|
|||||||
$this->newLine();
|
$this->newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function update(int $playerCount)
|
protected function updatePlayers(int $playerCount)
|
||||||
{
|
{
|
||||||
$res_player = StatistikoDetail::query()->where('is_active', 1)->limit($playerCount)->pluck('ss_player_id')->toArray();
|
$res_player = StatistikoDetail::query()->where('is_active', 1)->limit($playerCount)->pluck('ss_player_id')->toArray();
|
||||||
|
|
||||||
Reference in new issue
Block a user