From 82429fc63ea2c4e5464acd4860d18ab7c94ac8df Mon Sep 17 00:00:00 2001 From: wuliangbo Date: Wed, 4 Mar 2020 16:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- src/Base/Model/AlipayUserInfoShareReqyest.php | 14 ++++++++++++++ src/Base/Oauth/Client.php | 18 ++++++++++++++++++ src/Kernel/AppClient.php | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Base/Model/AlipayUserInfoShareReqyest.php diff --git a/composer.json b/composer.json index 460d46e..97ae12b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "shulidata/easyalipay", + "name": "wuearl/easyalipay", "description": "支付宝SDK", "keywords": [ "alipay", @@ -12,6 +12,7 @@ "php": ">=7.1", "ext-fileinfo": "*", "ext-openssl": "*", + "ext-json": "*", "ext-simplexml": "*", "guzzlehttp/guzzle": "^6.2", "pimple/pimple": "^3.0", diff --git a/src/Base/Model/AlipayUserInfoShareReqyest.php b/src/Base/Model/AlipayUserInfoShareReqyest.php new file mode 100644 index 0000000..16d6b67 --- /dev/null +++ b/src/Base/Model/AlipayUserInfoShareReqyest.php @@ -0,0 +1,14 @@ +setRefreshToken($refresh_token); return ($this->execute($request)); } + + /** + * @param string $token + * @return \EasyAlipay\Kernel\Support\Collection + * @throws \EasyAlipay\Kernel\Exceptions\BadRequestException + * @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException + * @throws \EasyAlipay\Kernel\Exceptions\InvalidConfigException + * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function user(string $token) + { + $this->config['auth_token'] = $token; + $request = new AlipayUserInfoShareReqyest(); + $request->setApiMethodName('alipay.user.info.share'); + return ($this->execute($request)); + } } diff --git a/src/Kernel/AppClient.php b/src/Kernel/AppClient.php index 71323b1..81661e0 100755 --- a/src/Kernel/AppClient.php +++ b/src/Kernel/AppClient.php @@ -152,12 +152,14 @@ class AppClient extends BaseClient throw new InvalidConfigException("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!"); } $sysParams = $this->buildParams($request); + //获取业务参数 $apiParams = $request->getApiParas(); if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) { $sysParams["encrypt_type"] = $this->encryptType; $apiParams['biz_content'] = $this->encryptCode($apiParams['biz_content']); } + //签名 $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType); $requestUrl = $this->buildRequestUrl($sysParams);