From 4c36b37fa2f0ca30ab43e90b3767a94515384d5e Mon Sep 17 00:00:00 2001 From: zhouchangcheng Date: Mon, 27 May 2024 12:13:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84api=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/apiRequest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; }