完善api request

This commit is contained in:
zhouchangcheng 2024-05-27 12:13:29 +08:00
parent 4284066120
commit 4c36b37fa2

View File

@ -20,6 +20,11 @@ public static function getClient(): Client
return self::$client; return self::$client;
} }
public static function SetClient(Client $client): void
{
self::$client = $client;
}
/** /**
* @throws GuzzleException * @throws GuzzleException
*/ */
@ -107,7 +112,7 @@ public static function GetToken(): string
throw new Exception('获取token失败:' . $res['desc'] ?? ''); throw new Exception('获取token失败:' . $res['desc'] ?? '');
} }
$token = $res['data']['token']; $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; return $token;
} }