Browse Source

增加接口

master
wuliangbo 5 years ago
parent
commit
82429fc63e
  1. 3
      composer.json
  2. 14
      src/Base/Model/AlipayUserInfoShareReqyest.php
  3. 18
      src/Base/Oauth/Client.php
  4. 2
      src/Kernel/AppClient.php

3
composer.json

@ -1,5 +1,5 @@
{ {
"name": "shulidata/easyalipay", "name": "wuearl/easyalipay",
"description": "支付宝SDK", "description": "支付宝SDK",
"keywords": [ "keywords": [
"alipay", "alipay",
@ -12,6 +12,7 @@
"php": ">=7.1", "php": ">=7.1",
"ext-fileinfo": "*", "ext-fileinfo": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-json": "*",
"ext-simplexml": "*", "ext-simplexml": "*",
"guzzlehttp/guzzle": "^6.2", "guzzlehttp/guzzle": "^6.2",
"pimple/pimple": "^3.0", "pimple/pimple": "^3.0",

14
src/Base/Model/AlipayUserInfoShareReqyest.php

@ -0,0 +1,14 @@
<?php
/**
* Created by PhpStorm.
* User: wuliangbo
* Date: 2020/3/4
* Time: 09:59
*/
namespace EasyAlipay\Base\Model;
use EasyAlipay\Kernel\AppRequest;
class AlipayUserInfoShareReqyest extends AppRequest
{
}

18
src/Base/Oauth/Client.php

@ -2,6 +2,7 @@
namespace EasyAlipay\Base\Oauth; namespace EasyAlipay\Base\Oauth;
use EasyAlipay\Base\Model\AlipayUserInfoShareReqyest;
use EasyAlipay\Kernel\AppClient; use EasyAlipay\Kernel\AppClient;
use EasyAlipay\Base\Model\AlipaySystemOauthTokenRequest; use EasyAlipay\Base\Model\AlipaySystemOauthTokenRequest;
@ -28,4 +29,21 @@ class Client extends AppClient
$request->setRefreshToken($refresh_token); $request->setRefreshToken($refresh_token);
return ($this->execute($request)); 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));
}
} }

2
src/Kernel/AppClient.php

@ -152,12 +152,14 @@ class AppClient extends BaseClient
throw new InvalidConfigException("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!"); throw new InvalidConfigException("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
} }
$sysParams = $this->buildParams($request); $sysParams = $this->buildParams($request);
//获取业务参数 //获取业务参数
$apiParams = $request->getApiParas(); $apiParams = $request->getApiParas();
if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) { if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
$sysParams["encrypt_type"] = $this->encryptType; $sysParams["encrypt_type"] = $this->encryptType;
$apiParams['biz_content'] = $this->encryptCode($apiParams['biz_content']); $apiParams['biz_content'] = $this->encryptCode($apiParams['biz_content']);
} }
//签名 //签名
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType); $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
$requestUrl = $this->buildRequestUrl($sysParams); $requestUrl = $this->buildRequestUrl($sysParams);

Loading…
Cancel
Save