This commit is contained in:
salam committed 2026-09-08 08:44:04 +02:00
1 parent 9f157adc96
commit 29de0c2c6c
13 files changed
+324 -789

No files matched your search

@@ -2,10 +2,10 @@
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grap;
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
use App\Console\Commands\Grap;
use App\Models\SofaScoreRosa;
use App\Utilities\Notice;
use Illuminate\Support\Facades\File;
@@ -17,13 +17,12 @@ class Rose
$debug = Grap::$options['d'] ?? 0;
$restart = Grap::$options['r'] ?? 0;
if ($debug && !$restart) {
Notice::note("RESTART ?", 'bb');
if ($debug && ! $restart) {
Notice::note('RESTART ?', 'bb');
sleep(5);
}
File::makeDirectory(Grap::$storage . '/' . Grap::$folder, 0775, true, true);
File::makeDirectory(Grap::$storage.'/'.Grap::$folder, 0775, true, true);
if ($restart) {
SofaScoreRosa::query()->update(['grapped' => 0]);
@@ -36,8 +35,7 @@ class Rose
}
}
$res = SofaScoreRosa::where('grapped', 0)->get();
$res = SofaScoreRosa::where('is_active', 1)->where('grapped', 0)->get();
$all = $res->count();
@@ -52,7 +50,7 @@ class Rose
echo "\n$key/$all\n";
}
$url = Grap::$options['base_url'] . 'api/v1/team/' . $value->ss_team_id . '/players';
$url = Grap::$options['base_url'].'api/v1/team/'.$value->ss_team_id.'/players';
$data = CurlSofa::load($url);
@@ -63,7 +61,7 @@ class Rose
* add team to folder
*********************************/
File::put(Grap::$storage . '/' . Grap::$folder . '/' . Strings::clean($value->ss_team_name) . '.json', json_encode($data));
File::put(Grap::$storage.'/'.Grap::$folder.'/'.Strings::clean($value->ss_team_name).'.json', json_encode($data));
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grap;
use App\Models\SofaScoreRosa;
use App\Models\SofaScoreTask;
use App\Models\SofaScoreTaskTournament;
use App\Models\SofaScoreTournament;
@@ -16,17 +17,29 @@ class SettingsToLocal
$debug = Grap::$options['d'] ?? 0;
if ($debug) {
Notice::note("⚽ settings to local");
Notice::note("⚽ close all vpn");
Notice::note('⚽ settings to local');
Notice::note('⚽ close all vpn');
}
exec('killall ssh');
if ($debug) {
Notice::note("⚽ open vpn");
Notice::note('⚽ open vpn');
}
exec('ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190');
/**
* SofaScoreRosa
*/
if ($debug) {
Notice::note('SofaScoreRosa', 'g');
}
SofaScoreRosa::truncate();
$rows = DB::connection('remote_mariadb')->table('sofa_score_rosas')->get();
foreach ($rows as $row) {
SofaScoreRosa::insert((array) $row);
}
/**
* SofaScoreTask
*/
if ($debug) {
Notice::note('SofaScoreTask', 'g');
}
@@ -35,7 +48,9 @@ class SettingsToLocal
foreach ($rows as $row) {
SofaScoreTask::insert((array) $row);
}
/**
* SofaScoreTaskTournament
*/
if ($debug) {
Notice::note('SofaScoreTaskTournament', 'g');
}
@@ -44,7 +59,9 @@ class SettingsToLocal
foreach ($rows as $row) {
SofaScoreTaskTournament::insert((array) $row);
}
/**
* SofaScoreTournament
*/
if ($debug) {
Notice::note('SofaScoreTournament', 'g');
}
@@ -55,7 +72,7 @@ class SettingsToLocal
}
if ($debug) {
Notice::note("⚽ close all vpn");
Notice::note('⚽ close all vpn');
}
exec('killall ssh');
}