完善api request
This commit is contained in:
parent
4284066120
commit
4c36b37fa2
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user