|
@@ -68,18 +68,20 @@ class WechatService extends EasywechatPlus
|
|
|
*/
|
|
|
public function getWechatSession($code)
|
|
|
{
|
|
|
- $access_token = $this->getAccessToken();
|
|
|
- $url = "https://api.weixin.qq.com/sns/jscode2session";
|
|
|
- $result = HttpClient::request('get', $url, [
|
|
|
- 'query' => [
|
|
|
- "access_token" => $access_token['access_token'],
|
|
|
- 'appid' => $this->app->app_id,
|
|
|
- 'secret' => $this->app->app_secret,
|
|
|
- 'js_code' => $code,
|
|
|
- 'grant_type' => 'authorization_code'
|
|
|
- ],
|
|
|
- ]);
|
|
|
- $result = $result->getBody()->getContents();
|
|
|
+ // $access_token = $this->getAccessToken();
|
|
|
+ // $url = "https://api.weixin.qq.com/sns/jscode2session";
|
|
|
+ // $result = HttpClient::request('get', $url, [
|
|
|
+ // 'query' => [
|
|
|
+ // "access_token" => $access_token['access_token'],
|
|
|
+ // 'appid' => $this->app->app_id,
|
|
|
+ // 'secret' => $this->app->app_secret,
|
|
|
+ // 'js_code' => $code,
|
|
|
+ // 'grant_type' => 'authorization_code'
|
|
|
+ // ],
|
|
|
+ // ]);
|
|
|
+ $result = $this->app->auth->session($code);
|
|
|
+ Log::write('getWechatSession:'.$result);
|
|
|
+ //$result = $result->getBody()->getContents();
|
|
|
$result = json_decode($result, true);
|
|
|
if ($result['errcode'] == 0) {
|
|
|
return $result;
|