wip grapper tournaments
This commit is contained in:
1 parent
acf74c5e82
commit
06c014fa1b
9 files changed
+151
-28
No files matched your search
@@ -33,6 +33,7 @@ class Sofascore
|
|||||||
{
|
{
|
||||||
$function = Nuh::$options['fun'];
|
$function = Nuh::$options['fun'];
|
||||||
|
|
||||||
|
|
||||||
switch ($function) {
|
switch ($function) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Nuh;
|
|||||||
use App\Models\SofaScoreRosa;
|
use App\Models\SofaScoreRosa;
|
||||||
use App\Models\SofaScoreTask;
|
use App\Models\SofaScoreTask;
|
||||||
use App\Models\SofaScoreTaskTournament;
|
use App\Models\SofaScoreTaskTournament;
|
||||||
|
use App\Models\SofaScoreTournament;
|
||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -38,12 +39,12 @@ class SettingsToLocal
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
Notice::note('SofaScoreRosa', 'g');
|
Notice::note('SofaScoreTournament', 'g');
|
||||||
}
|
}
|
||||||
SofaScoreRosa::truncate();
|
SofaScoreTournament::truncate();
|
||||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_rosas')->get();
|
$rows = DB::connection('remote_mariadb')->table('sofa_score_tournaments')->get();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
SofaScoreRosa::insert((array) $row);
|
SofaScoreTournament::insert((array) $row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
|||||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||||
use App\Console\Commands\Nuh;
|
use App\Console\Commands\Nuh;
|
||||||
use App\Models\SofaScoreRosa;
|
use App\Models\SofaScoreRosa;
|
||||||
|
use App\Models\SofaScoreRosaTournament;
|
||||||
use App\Models\SofaScoreTournament;
|
use App\Models\SofaScoreTournament;
|
||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
|
|
||||||
@@ -22,13 +23,14 @@ class TournamentTeams
|
|||||||
$tournaments = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->get();
|
$tournaments = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->get();
|
||||||
|
|
||||||
SofaScoreRosa::query()->update(['grapped' => 0]);
|
SofaScoreRosa::query()->update(['grapped' => 0]);
|
||||||
|
SofaScoreRosaTournament::query()->update(['grapped' => 0]);
|
||||||
|
|
||||||
foreach ($tournaments as $tournament) {
|
foreach ($tournaments as $tournament) {
|
||||||
|
|
||||||
$tournaments_counter++;
|
$tournaments_counter++;
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
Notice::note("Tournament: $tournament->name", 'bb');
|
Notice::note("$tournaments_counter Tournament: $tournament->name", 'bb');
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->tournament_id/seasons";
|
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->tournament_id/seasons";
|
||||||
@@ -45,6 +47,7 @@ class TournamentTeams
|
|||||||
|
|
||||||
$data = CurlSofa::load($url);
|
$data = CurlSofa::load($url);
|
||||||
|
|
||||||
|
if (isset($data['standings'])) {
|
||||||
foreach ($data['standings'][0]['rows'] as $row) {
|
foreach ($data['standings'][0]['rows'] as $row) {
|
||||||
$teams_counter++;
|
$teams_counter++;
|
||||||
|
|
||||||
@@ -56,14 +59,24 @@ class TournamentTeams
|
|||||||
'sport_id' => $tournament->sport_id,
|
'sport_id' => $tournament->sport_id,
|
||||||
'ssteam_id' => (int) $ssteam_id,
|
'ssteam_id' => (int) $ssteam_id,
|
||||||
], [
|
], [
|
||||||
'ss_tournament_id' => (int) $tournament->tournament_id,
|
|
||||||
'country_id' => (int) $country_id,
|
'country_id' => (int) $country_id,
|
||||||
'ssteam_name' => $name,
|
'ssteam_name' => $name,
|
||||||
'grapped' => 1,
|
'grapped' => 1,
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
]);
|
]);
|
||||||
|
SofaScoreRosaTournament::updateOrCreate([
|
||||||
|
'ss_tournament_id' => (int) $tournament->tournament_id,
|
||||||
|
'ssteam_id' => (int) $ssteam_id,
|
||||||
|
], [
|
||||||
|
'grapped' => 1,
|
||||||
|
'disabled' => 0,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SofaScoreRosa::where('grapped', 0)->update(['disabled' => 1]);
|
||||||
|
SofaScoreRosaTournament::where('grapped', 0)->update(['disabled' => 1]);
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
Notice::note("summe tournaments: $tournaments_counter", 'p');
|
Notice::note("summe tournaments: $tournaments_counter", 'p');
|
||||||
|
|||||||
+13
-3
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables;
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables;
|
||||||
|
|
||||||
|
use App\Models\SofaScoreRosaTournament;
|
||||||
use App\Models\SofaScoreTournament;
|
use App\Models\SofaScoreTournament;
|
||||||
use App\Models\Sport;
|
use App\Models\Sport;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
@@ -17,10 +18,11 @@ class SofaScoreRosasTable
|
|||||||
public static function configure(Table $table): Table
|
public static function configure(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
|
->defaultPaginationPageOption(50)
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('ssteam_id')->label('SSId')->badge()->width('1rem'),
|
TextColumn::make('ssteam_id')->label('SSId')->badge()->width('1rem'),
|
||||||
TextColumn::make('country.name')->label('Country'),
|
TextColumn::make('country.name')->label('Country'),
|
||||||
TextColumn::make('tournament.name')->label('Tournament'),
|
TextColumn::make('tournament_rosa.tournament.name')->label('Tournament'),
|
||||||
TextColumn::make('ssteam_name')->label('Name'),
|
TextColumn::make('ssteam_name')->label('Name'),
|
||||||
TextColumn::make('updated_at')->dateTime('Y-m-d H:i:s')
|
TextColumn::make('updated_at')->dateTime('Y-m-d H:i:s')
|
||||||
])
|
])
|
||||||
@@ -38,13 +40,17 @@ class SofaScoreRosasTable
|
|||||||
})
|
})
|
||||||
->live(),
|
->live(),
|
||||||
Select::make('ss_tournament_id')
|
Select::make('ss_tournament_id')
|
||||||
|
->default(23)
|
||||||
->label('Tournament')
|
->label('Tournament')
|
||||||
|
->selectablePlaceholder(false)
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
$res = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->where('sport_id', $get('sport_id'))->get();
|
$res = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->where('sport_id', $get('sport_id'))->get();
|
||||||
$return = [];
|
$return = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
$return[$value->tournament_id] = $value->sofascore_category->name . ' ' . $value->name;
|
$return[$value->tournament_id] = $value->sofascore_category->name . ' - ' . $value->name;
|
||||||
}
|
}
|
||||||
|
asort($return);
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
})
|
})
|
||||||
->live(),
|
->live(),
|
||||||
@@ -55,7 +61,11 @@ class SofaScoreRosasTable
|
|||||||
fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||||
)->when(
|
)->when(
|
||||||
$data['ss_tournament_id'],
|
$data['ss_tournament_id'],
|
||||||
fn(Builder $query, $ss_tournament_id) => $query->where('ss_tournament_id', $ss_tournament_id)
|
function (Builder $query, $ss_tournament_id) {
|
||||||
|
$ssteam_ids = SofaScoreRosaTournament::where('ss_tournament_id', $ss_tournament_id)->pluck('ssteam_id')->toArray();
|
||||||
|
|
||||||
|
$query->whereIn('ssteam_id', $ssteam_ids);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class SofaScoreRosa extends Model
|
|||||||
return $this->belongsTo(Country::class);
|
return $this->belongsTo(Country::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tournament()
|
public function tournament_rosa()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(SofaScoreTournament::class, 'ss_tournament_id', 'tournament_id');
|
return $this->belongsTo(SofaScoreRosaTournament::class, 'ssteam_id', 'ssteam_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SofaScoreRosaTournament extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'ssteam_id',
|
||||||
|
'ss_tournament_id',
|
||||||
|
'grapped',
|
||||||
|
'disabled',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function tournament()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(SofaScoreTournament::class, 'ss_tournament_id', 'tournament_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,6 @@ return new class extends Migration
|
|||||||
$table->integer('ssteam_id')->index();
|
$table->integer('ssteam_id')->index();
|
||||||
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
|
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
|
||||||
$table->string('ssteam_name');
|
$table->string('ssteam_name');
|
||||||
$table->integer('ss_tournament_id')->default(0)->nullable()->index();
|
|
||||||
$table->boolean('is_active')->default(false);
|
$table->boolean('is_active')->default(false);
|
||||||
$table->boolean('disabled')->default(false);
|
$table->boolean('disabled')->default(false);
|
||||||
$table->boolean('grapped')->default(false);
|
$table->boolean('grapped')->default(false);
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('sofa_score_rosa_tournaments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('ssteam_id')->index();
|
||||||
|
$table->integer('ss_tournament_id')->default(0)->nullable()->index();
|
||||||
|
$table->boolean('disabled')->default(false);
|
||||||
|
$table->boolean('grapped')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sofa_score_rosa_tournaments');
|
||||||
|
}
|
||||||
|
};
|
||||||
+64
-16
@@ -1,9 +1,9 @@
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
"1")
|
"1")
|
||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;32m";
|
echo "\033[1;31m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "⚽ Daily Task: 1"
|
echo "Task: 1 ⚽ Daily"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
"2")
|
"2")
|
||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;34m";
|
echo "\033[1;32m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "⚽ Day: 2"
|
echo "Task: 2 ⚽ Single Day"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;33m";
|
echo "\033[1;33m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "⚽ Range Task: 3"
|
echo "Task: 3 ⚽ Date Range"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
|
|
||||||
@@ -89,7 +89,26 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;35m";
|
echo "\033[1;35m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "⚽ Rosa Task: 4"
|
echo "Task: 4 ⚽ Tornament"
|
||||||
|
echo "--------------------------"
|
||||||
|
echo "\033[0;0m";
|
||||||
|
|
||||||
|
echo "\n--------------------------"
|
||||||
|
echo "5 sec to stop"
|
||||||
|
echo "restart with second param: 1"
|
||||||
|
echo "--------------------------"
|
||||||
|
#sleep 5
|
||||||
|
|
||||||
|
php artisan nuh --d --f 67 --fun=9 --restart=$2
|
||||||
|
|
||||||
|
echo "\n😎 task done :)"
|
||||||
|
echo ""
|
||||||
|
;;
|
||||||
|
"5")
|
||||||
|
echo ""
|
||||||
|
echo "\033[1;35m";
|
||||||
|
echo "--------------------------"
|
||||||
|
echo "Task: 5 ⚽ Rooster"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
|
|
||||||
@@ -99,17 +118,16 @@ case "$1" in
|
|||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo "\n⚽ Rosa"
|
|
||||||
php artisan nuh --d --f 67 --fun=6 --task=4 --restart=$2
|
php artisan nuh --d --f 67 --fun=6 --task=4 --restart=$2
|
||||||
|
|
||||||
echo "\n😎 task done :)"
|
echo "\n😎 task done :)"
|
||||||
echo ""
|
echo ""
|
||||||
;;
|
;;
|
||||||
"5")
|
"6")
|
||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;36m";
|
echo "\033[1;36m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "⚽ Copy Settings: 5"
|
echo "Task: 6 ⚽ Copy to DEV"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
|
|
||||||
@@ -124,7 +142,6 @@ case "$1" in
|
|||||||
echo "\n⚽ open vpn"
|
echo "\n⚽ open vpn"
|
||||||
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
|
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
|
||||||
|
|
||||||
echo "\n⚽ Settings To Local"
|
|
||||||
php artisan nuh --d --f 67 --fun=2 --task=0
|
php artisan nuh --d --f 67 --fun=2 --task=0
|
||||||
|
|
||||||
echo "\n⚽ close vpn"
|
echo "\n⚽ close vpn"
|
||||||
@@ -133,22 +150,53 @@ case "$1" in
|
|||||||
echo "\n😎 task done :)"
|
echo "\n😎 task done :)"
|
||||||
echo ""
|
echo ""
|
||||||
;;
|
;;
|
||||||
|
"6")
|
||||||
|
echo ""
|
||||||
|
echo "\033[1;36m";
|
||||||
|
echo "--------------------------"
|
||||||
|
echo "Task: 7 ⚽ Copy to PROD"
|
||||||
|
echo "--------------------------"
|
||||||
|
echo "\033[0;0m";
|
||||||
|
|
||||||
|
echo "\n--------------------------"
|
||||||
|
echo "5 sec to stop"
|
||||||
|
echo "--------------------------"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
echo "\n⚽ close all vpn"
|
||||||
|
killall ssh
|
||||||
|
|
||||||
|
echo "\n⚽ open vpn"
|
||||||
|
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
|
||||||
|
|
||||||
|
# php artisan nuh --d --f 67 --fun=2 --task=0
|
||||||
|
|
||||||
|
echo "\n⚽ close vpn"
|
||||||
|
killall ssh
|
||||||
|
|
||||||
|
echo "\n😎 task done :)"
|
||||||
|
echo ""
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo ""
|
echo ""
|
||||||
echo "\033[1;30m";
|
echo "\033[1;30m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
echo " Grapper Options"
|
echo " Grapper Options"
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
|
echo "\033[1;31m";
|
||||||
|
echo "Task: 1 ⚽ Daily"
|
||||||
echo "\033[1;32m";
|
echo "\033[1;32m";
|
||||||
echo "⚽ Daily\tTask: 1"
|
echo "Task: 2 ⚽ Single Day"
|
||||||
echo "\033[1;34m";
|
|
||||||
echo "⚽ Day\t\tTask: 2"
|
|
||||||
echo "\033[1;33m";
|
echo "\033[1;33m";
|
||||||
echo "⚽ Range\tTask: 3"
|
echo "Task: 3 ⚽ Date Range"
|
||||||
|
echo "\033[1;34m";
|
||||||
|
echo "Task: 4 ⚽ Tornament"
|
||||||
echo "\033[1;35m";
|
echo "\033[1;35m";
|
||||||
echo "⚽ Rosa\t\tTask: 4"
|
echo "Task: 5 ⚽ Rooster"
|
||||||
echo "\033[1;36m";
|
echo "\033[1;36m";
|
||||||
echo "⚽ Settings\tTask: 5"
|
echo "Task: 6 ⚽ Copy to DEV"
|
||||||
|
echo "\033[1;36m";
|
||||||
|
echo "Task: 7 ⚽ Copy to PROD"
|
||||||
echo "\033[0;0m";
|
echo "\033[0;0m";
|
||||||
echo "--------------------------"
|
echo "--------------------------"
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in new issue
Block a user