wip
This commit is contained in:
1 parent
6d8d5f9136
commit
dc5480f91c
10 files changed
+185
-13
No files matched your search
@@ -12,6 +12,7 @@ use App\Models\SofaScoreTournament;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Tournament
|
||||
{
|
||||
@@ -51,19 +52,13 @@ class Tournament
|
||||
while ($page) {
|
||||
$url = Nuh::$options['base_url']."api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
|
||||
|
||||
$rand = rand(1000000, 2000000);
|
||||
$rand = rand(500000, 1000000);
|
||||
if ($debug) {
|
||||
Notice::note("Sleep $rand msec", 'y');
|
||||
}
|
||||
usleep($rand);
|
||||
|
||||
// $data = Curl::load($url);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
$data = json_decode($response, true);
|
||||
$data = Curl::load($url);
|
||||
|
||||
if ($data['hasNextPage']) {
|
||||
$page++;
|
||||
@@ -99,6 +94,12 @@ class Tournament
|
||||
'Sao Tome and Principe',
|
||||
'Cape Verde',
|
||||
'Macao',
|
||||
'Saint Kitts and Nevis',
|
||||
'Eswatini',
|
||||
'Timor Leste',
|
||||
'Laos',
|
||||
'Congo Republic',
|
||||
|
||||
];
|
||||
$replace = [
|
||||
'',
|
||||
@@ -111,6 +112,11 @@ class Tournament
|
||||
'Sao Tome e Principe',
|
||||
'Cape Verde Islands',
|
||||
'Macau',
|
||||
'St. Kitts and Nevis',
|
||||
'Swaziland',
|
||||
'East Timor',
|
||||
'Lao Peoples\'s Democratic Republic',
|
||||
'Congo DR',
|
||||
];
|
||||
$country_id = Country::where('name', trim(str_replace($find, $replace, $category['name'])))->value('id');
|
||||
}
|
||||
@@ -118,6 +124,8 @@ class Tournament
|
||||
if (! $country_id) {
|
||||
// platzhalter fix later sofa_score_categories => txodds countries
|
||||
// CATEGORY find <-> replace
|
||||
Log::channel('sofascore')->info($tournament);
|
||||
|
||||
$sofa_score_categorie_id = 10000000;
|
||||
} else {
|
||||
$call = SofaScoreCategorie::updateOrCreate([
|
||||
|
||||
Reference in new issue
Block a user