fix mapper

This commit is contained in:
salam committed 2026-06-07 16:34:19 +02:00
1 parent b4b3f1e1ea
commit 336af556a1
9 files changed
+893 -1432

No files matched your search

@@ -20,13 +20,18 @@ class Events
public static $sport = [1];
public static function switch()
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$sportmap = Sport::whereIn('id', self::$sport)->select('id', 'sofascore', 'ss_slug')->get();
$sport_id = Nuh::$options['sport_id'];
$time_zone_offset = 0;
$sport = Sport::where('id', $sport_id)->first();
$dates = Carbon::now();
// to grap event id
// https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2022-05-19
$years_back = 7;
@@ -46,7 +51,7 @@ class Events
$page = 1;
while ($page) {
$url = Nuh::$options['base_url']."api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
$url = Nuh::$options['base_url'] . "api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
$data = Curl::load($url);
@@ -16,12 +16,6 @@ use Illuminate\Support\Facades\Log;
class Tournament
{
public static $auth_header = [];
public static $base_url = '';
public static $sport = [1];
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
@@ -44,13 +38,13 @@ class Tournament
if (! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) {
if ($debug) {
Notice::note('Grapping Sport: '.Nuh::$options['sport'].' Day: '.$day, 'g');
Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'g');
}
$page = 1;
while ($page) {
$url = Nuh::$options['base_url']."api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
$url = Nuh::$options['base_url'] . "api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
$rand = rand(500000, 1000000);
if ($debug) {
@@ -164,7 +158,6 @@ class Tournament
Notice::note("tournaments: $tournaments_counter", 'p');
SofaScoreDay::updateOrCreate(['day' => $day], [$sport->ss_slug => 1]);
}
if (Nuh::$options['test']) {
@@ -172,7 +165,7 @@ class Tournament
}
} else {
if ($debug) {
Notice::note('Having Sport: '.Nuh::$options['sport'].' Day: '.$day, 'b');
Notice::note('Having Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'b');
}
}
$dates->subDay();