diff --git a/app/helpers/apiRequest.php b/app/helpers/apiRequest.php index 61be876..727d3dd 100644 --- a/app/helpers/apiRequest.php +++ b/app/helpers/apiRequest.php @@ -20,6 +20,11 @@ public static function getClient(): Client return self::$client; } + public static function SetClient(Client $client): void + { + self::$client = $client; + } + /** * @throws GuzzleException */ @@ -107,7 +112,7 @@ public static function GetToken(): string throw new Exception('获取token失败:' . $res['desc'] ?? ''); } $token = $res['data']['token']; - Cache::set('token', $token, strtotime($res['data']['deadline']) - time()); + Cache::set('token', $token, strtotime($res['data']['deadline']) - time() - 300); return $token; }