From 981a19aca28554f86f9b29a53f533e1acb26aa8e Mon Sep 17 00:00:00 2001 From: justmd5 Date: Tue, 7 Dec 2021 15:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9php8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ composer.json | 4 ++-- src/AccessToken.php | 9 ++++++--- src/Api.php | 1 - src/Oauth/ServiceProvider.php | 3 ++- src/ServiceProvider.php | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88e99d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor +composer.lock \ No newline at end of file diff --git a/composer.json b/composer.json index 9109618..4e00a35 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ } }, "require": { - "php": "^7.0", - "hanson/foundation-sdk": "4.0.2", + "php": "^7.0||^8.0", + "hanson/foundation-sdk": "^5.0", "ext-json": "*" } } diff --git a/src/AccessToken.php b/src/AccessToken.php index 04ef65c..40c6aa1 100644 --- a/src/AccessToken.php +++ b/src/AccessToken.php @@ -9,6 +9,7 @@ namespace Justmd5\PinDuoDuo; use Hanson\Foundation\AbstractAccessToken; +use Hanson\Foundation\Foundation; class AccessToken extends AbstractAccessToken { @@ -30,11 +31,13 @@ class AccessToken extends AbstractAccessToken protected $expiresJsonKey = 'expires_in'; /** - * @param string $clientId - * @param string $secret + * @param string $clientId + * @param string $secret + * @param Foundation $app */ - public function __construct(string $clientId, string $secret) + public function __construct(string $clientId, string $secret, Foundation $app) { + parent::__construct($app); $this->appId = $clientId; $this->secret = $secret; } diff --git a/src/Api.php b/src/Api.php index 1fc42e7..a17832e 100644 --- a/src/Api.php +++ b/src/Api.php @@ -22,7 +22,6 @@ class Api extends AbstractAPI public function __construct(PinDuoDuo $pinduoduo, $needToken = false) { - parent::__construct($pinduoduo); $this->pinduoduo = $pinduoduo; $this->needToken = $needToken; } diff --git a/src/Oauth/ServiceProvider.php b/src/Oauth/ServiceProvider.php index 2156029..887ec55 100755 --- a/src/Oauth/ServiceProvider.php +++ b/src/Oauth/ServiceProvider.php @@ -26,7 +26,8 @@ public function register(Container $pimple) $pimple['oauth.access_token'] = function (Foundation $pimple) { $accessToken = new AccessToken( $pimple->getConfig('client_id'), - $pimple->getConfig('client_secret') + $pimple->getConfig('client_secret'), + $pimple ); $accessToken->setHttp($pimple->http); $accessToken->setRequest($pimple['request']); diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index dee637a..ac7edd2 100755 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -26,7 +26,8 @@ public function register(Container $pimple) $pimple['access_token'] = function (Foundation $pimple) { return new AccessToken( $pimple->getConfig('client_id'), - $pimple->getConfig('client_secret') + $pimple->getConfig('client_secret'), + $pimple ); };