dever 7 years ago
parent
commit
275191aadb
1 changed files with 4 additions and 2 deletions
  1. 4 2
      component/src/Auth.php

+ 4 - 2
component/src/Auth.php

@@ -52,9 +52,11 @@ class Auth
 		$project = $this->wechat->project();
 		$param['js_code'] = Dever::input('code');
 		$param['appid'] = Dever::input('appid');
-		//$param['component_access_token'] = $this->wechat->token();
+		$param['component_access_token'] = $this->wechat->token();
 		$param['component_appid'] = $project['appid'];
-		$data = $this->wechat->curl('applet_login', $param);
+		$param['grant_type'] = 'authorization_code';
+		$url = 'https://api.weixin.qq.com/sns/component/jscode2session?' . http_build_query($param);
+		$data = Dever::curl($url);
 
 		echo $data;die;
 	}