From 48a7d08bac2924351581ee1a367ba301786e46ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Thu, 21 Feb 2019 12:05:41 +0800 Subject: [PATCH] message --- src/Wechat/Work/Base.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Wechat/Work/Base.php b/src/Wechat/Work/Base.php index d37df8c..e27b3c2 100644 --- a/src/Wechat/Work/Base.php +++ b/src/Wechat/Work/Base.php @@ -48,9 +48,21 @@ class Base return $request; } + public function transformForAccessTokenRequest($uri, $params) + { + $uri = new Uri($uri); + foreach ($params as $param) { + $uri = Uri::withQueryValues($uri, $params); + } + + $request = new Request('GET', $uri, []); + return $request; + } + public function transformForGetRequest($uri, $params) { $uri = new Uri($uri); + $uri = Uri::withQueryValue($uri, 'access_token', $this->getAccessToken()); foreach ($params as $param) { $uri = Uri::withQueryValues($uri, $params); } @@ -81,7 +93,7 @@ class Base return $token; } - $request = $this->transformForGetRequest('gettoken', [ + $request = $this->transformForAccessTokenRequest('gettoken', [ 'corpid' => $config['corp_id'], 'corpsecret' => $config['secret'] ]);