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'] ]);