|
@@ -8,14 +8,14 @@
|
|
|
class Client
|
|
class Client
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- //
|
|
|
|
|
|
|
+ //
|
|
|
public static function get($endpoint, $params = [])
|
|
public static function get($endpoint, $params = [])
|
|
|
{
|
|
{
|
|
|
$response = Http::withHeaders([
|
|
$response = Http::withHeaders([
|
|
|
'x-apisports-key' => config('services.api_football.key'),
|
|
'x-apisports-key' => config('services.api_football.key'),
|
|
|
])
|
|
])
|
|
|
- ->withoutVerifying() // 临时跳过 SSL 验证
|
|
|
|
|
- ->get(config('services.api_football.host') .'/'. $endpoint, $params);
|
|
|
|
|
|
|
+ ->withoutVerifying() // 临时跳过 SSL 验证
|
|
|
|
|
+ ->get(config('services.api_football.host') . '/' . $endpoint, $params);
|
|
|
|
|
|
|
|
if ($response->successful()) {
|
|
if ($response->successful()) {
|
|
|
return $response->json();
|
|
return $response->json();
|
|
@@ -29,7 +29,7 @@ public static function post($endpoint, $data = [])
|
|
|
{
|
|
{
|
|
|
$response = Http::withHeaders([
|
|
$response = Http::withHeaders([
|
|
|
'x-apisports-key' => config('services.api_football.key'),
|
|
'x-apisports-key' => config('services.api_football.key'),
|
|
|
- ])->post(config('services.api_football.host') .'/'. $endpoint, $data);
|
|
|
|
|
|
|
+ ])->post(config('services.api_football.host') . '/' . $endpoint, $data);
|
|
|
|
|
|
|
|
if ($response->successful()) {
|
|
if ($response->successful()) {
|
|
|
return $response->json();
|
|
return $response->json();
|
|
@@ -51,9 +51,14 @@ public static function countries($params = [])
|
|
|
return self::get('countries', $params);
|
|
return self::get('countries', $params);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function leagues($params = [])
|
|
|
|
|
+ {
|
|
|
|
|
+ return static::get('leagues', $params);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 赛程
|
|
// 赛程
|
|
|
public static function fixtures($params = [])
|
|
public static function fixtures($params = [])
|
|
|
{
|
|
{
|
|
|
return self::get('fixtures', $params);
|
|
return self::get('fixtures', $params);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|