wip
This commit is contained in:
1 parent
fc0f18ba73
commit
558430114a
11 files changed
+98
-135
No files matched your search
@@ -25,7 +25,6 @@ class DaysTournament
|
||||
|
||||
foreach ($days as $d) {
|
||||
|
||||
$langsam = $d['run_slow'];
|
||||
$sport_id = $d['sport_id'];
|
||||
$day = $d['day'];
|
||||
$slug = $d['slug'];
|
||||
@@ -48,7 +47,7 @@ class DaysTournament
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
|
||||
|
||||
Sleeper::rand($langsam);
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
@@ -146,9 +145,9 @@ class DaysTournament
|
||||
]);
|
||||
$tournaments_counter++;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('tournament: ' . $tournament['name'], 'p');
|
||||
}
|
||||
// if ($debug) {
|
||||
// Notice::note('tournament: ' . $tournament['name'], 'p');
|
||||
// }
|
||||
|
||||
/**
|
||||
* DAY TOURNAMENT
|
||||
|
||||
@@ -32,8 +32,6 @@ class Grapper
|
||||
|
||||
foreach ($days as $d) {
|
||||
|
||||
$langsam = $d['run_slow'];
|
||||
|
||||
$day = $d['day'];
|
||||
|
||||
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
|
||||
@@ -77,7 +75,7 @@ class Grapper
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/statistics";
|
||||
|
||||
Sleeper::rand($langsam);
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
@@ -94,7 +92,7 @@ class Grapper
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/lineups";
|
||||
|
||||
Sleeper::rand($langsam);
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
@@ -111,7 +109,7 @@ class Grapper
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/odds/1/all";
|
||||
|
||||
Sleeper::rand($langsam);
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
@@ -128,7 +126,7 @@ class Grapper
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/incidents";
|
||||
|
||||
Sleeper::rand($langsam);
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ class LoadDays
|
||||
$dates[] = [
|
||||
'day' => Carbon::now()->subDay()->format('Y-m-d'),
|
||||
'slug' => $task->sport->ss_slug,
|
||||
'run_slow' => $task->run_slow,
|
||||
'sport_id' => $task->sport_id,
|
||||
'run_repeatedly' => $task->run_repeatedly,
|
||||
];
|
||||
@@ -44,7 +43,6 @@ class LoadDays
|
||||
$dates[] = [
|
||||
'day' => self::validateDate($task->day_from),
|
||||
'slug' => $task->sport->ss_slug,
|
||||
'run_slow' => $task->run_slow,
|
||||
'sport_id' => $task->sport_id,
|
||||
'run_repeatedly' => $task->run_repeatedly,
|
||||
];
|
||||
@@ -68,7 +66,6 @@ class LoadDays
|
||||
$dates[] = [
|
||||
'day' => $from->format('Y-m-d'),
|
||||
'slug' => $task->sport->ss_slug,
|
||||
'run_slow' => $task->run_slow,
|
||||
'sport_id' => $task->sport_id,
|
||||
'run_repeatedly' => $task->run_repeatedly,
|
||||
];
|
||||
|
||||
@@ -2,29 +2,15 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Sleeper
|
||||
{
|
||||
public static function rand(bool $langsam = false)
|
||||
public static function rand($langsam = false)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
$langsam = false;
|
||||
}
|
||||
|
||||
if ($langsam) {
|
||||
$sleep = rand(2000000, 60000000);
|
||||
$sleep = rand(3000000, 6000000);
|
||||
} else {
|
||||
$sleep = rand(500000, 1000000);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("sleeping $sleep msec", 'y');
|
||||
}
|
||||
|
||||
usleep($sleep);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user