Browse Source

简化 代码

master 1.0
wlb 2 years ago
parent
commit
6d823950dd
  1. 10
      src/Base/Oauth/Client.php
  2. 12
      src/Marketing/Pass/Client.php
  3. 3
      src/MiniProgram/Application.php
  4. 4
      src/OpenPlatform/Application.php
  5. 8
      src/OpenPlatform/Authorizer/MiniProgram/Application.php

10
src/Base/Oauth/Client.php

@ -24,10 +24,8 @@ class Client extends BaseClient @@ -24,10 +24,8 @@ class Client extends BaseClient
'code' => $code,
'refresh_token' => $refresh_token
];
$this->method = 'alipay.user.oauth.token';
$sysParams = $this->buildParams($params);
$url = $this->_toUrlEncodedRequestBody($sysParams);
return $this->httpPost($url, $params);
$this->method = 'alipay.system.oauth.token';
return $this->httpPost($params);
}
/**
@ -43,9 +41,7 @@ class Client extends BaseClient @@ -43,9 +41,7 @@ class Client extends BaseClient
$this->app->config->set('auth_token', $token);
$params = [];
$this->method = 'alipay.user.info.share';
$sysParams = $this->buildParams($params);
$url = $this->_toUrlEncodedRequestBody($sysParams);
return $this->httpPost($url);
return $this->httpPost($params);
}
/**

12
src/Marketing/Pass/Client.php

@ -49,9 +49,7 @@ class Client extends BaseClient @@ -49,9 +49,7 @@ class Client extends BaseClient
'biz_content' => json_encode($biz_content, JSON_UNESCAPED_UNICODE)
];
$this->method = 'alipay.pass.template.update';
$sysParams = $this->buildParams($params);
$url = $this->_toUrlEncodedRequestBody($sysParams);
return $this->httpPost($url, $params);
return $this->httpPost($params);
}
/**
@ -77,9 +75,7 @@ class Client extends BaseClient @@ -77,9 +75,7 @@ class Client extends BaseClient
'biz_content' => json_encode($biz_content, JSON_UNESCAPED_UNICODE)
];
$this->method = 'alipay.pass.instance.add';
$sysParams = $this->buildParams($params);
$url = $this->_toUrlEncodedRequestBody($sysParams);
return $this->httpPost($url, $params);
return $this->httpPost($params);
}
/**
@ -102,8 +98,6 @@ class Client extends BaseClient @@ -102,8 +98,6 @@ class Client extends BaseClient
'biz_content' => json_encode($biz_content, JSON_UNESCAPED_UNICODE)
];
$this->method = 'alipay.pass.instance.update';
$sysParams = $this->buildParams($params);
$url = $this->_toUrlEncodedRequestBody($sysParams);
return $this->httpPost($url, $params);
return $this->httpPost($params);
}
}

3
src/MiniProgram/Application.php

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
namespace Alipay\MiniProgram;
use Alipay\Base\Oauth;
use Alipay\Kernel\ServiceContainer;
/**
@ -11,6 +12,7 @@ use Alipay\Kernel\ServiceContainer; @@ -11,6 +12,7 @@ use Alipay\Kernel\ServiceContainer;
* @property \Alipay\MiniProgram\AppCode\Client $app_code
* @property \Alipay\MiniProgram\TemplateMessage\Client $template_message
* @property \Alipay\MiniProgram\Risk\Client $risk
* @property \Alipay\Base\Oauth\Client $oauth
*
*/
class Application extends ServiceContainer
@ -23,5 +25,6 @@ class Application extends ServiceContainer @@ -23,5 +25,6 @@ class Application extends ServiceContainer
AppCode\ServiceProvider::class,
TemplateMessage\ServiceProvider::class,
Risk\ServiceProvider::class,
OAuth\ServiceProvider::class,
];
}

4
src/OpenPlatform/Application.php

@ -11,7 +11,7 @@ use Alipay\OpenPlatform\Authorizer\OfficialAccount\Application as officialAccoun @@ -11,7 +11,7 @@ use Alipay\OpenPlatform\Authorizer\OfficialAccount\Application as officialAccoun
* @package EasyAlipay\OpenPlatform
* @property \Alipay\OpenPlatform\Server\Guard $server
*
* @method mixed getToken(string $grant_type, string $code, string $refresh_token = '')
* @method mixed handleAuthorize(string $grant_type, string $code, string $refresh_token = '')
* @method mixed getPreAuthorizationUrl(string $redirect_uri, string $state, array $type = ['TINYAPP'])
* @method mixed getAuthorizer(string $appAuthToken)
*/
@ -41,7 +41,7 @@ class Application extends ServiceContainer @@ -41,7 +41,7 @@ class Application extends ServiceContainer
* @param string|null $appAuthToken
* @return officialAccount
*/
public function openPublic(string $appId, string $appAuthToken = null): officialAccount
public function officialAccount(string $appId, string $appAuthToken = null): officialAccount
{
$application = new officialAccount($this->getAuthorizerConfig($appId, $appAuthToken), $this->getReplaceServices());
return $application;

8
src/OpenPlatform/Authorizer/MiniProgram/Application.php

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
namespace Alipay\OpenPlatform\Authorizer\MiniProgram;
use Alipay\MiniProgram\Application as Mini;
use Alipay\MiniProgram\Application as MiniProgram;
/**
* Class Application
@ -14,9 +14,8 @@ use Alipay\MiniProgram\Application as Mini; @@ -14,9 +14,8 @@ use Alipay\MiniProgram\Application as Mini;
* @property \Alipay\OpenPlatform\Authorizer\MiniProgram\Members\Client $members
* @property \Alipay\OpenPlatform\Authorizer\MiniProgram\BaseInfo\Client $base_info
* @property \Alipay\OpenPlatform\Authorizer\MiniProgram\Category\Client $category
* @property \Alipay\Base\Oauth\Client $oauth
*/
class Application extends Mini
class Application extends MiniProgram
{
/**
* Application constructor.
@ -32,8 +31,7 @@ class Application extends Mini @@ -32,8 +31,7 @@ class Application extends Mini
Experience\ServiceProvider::class,
Members\ServiceProvider::class,
BaseInfo\ServiceProvider::class,
Category\ServiceProvider::class,
\Alipay\Base\Oauth\ServiceProvider::class,
Category\ServiceProvider::class
];
foreach ($providers as $provider) {

Loading…
Cancel
Save