...
|
...
|
@@ -405,17 +405,20 @@ class LoginController extends HomeBaseController |
|
|
|
|
|
//第三方微信移动端网页登录
|
|
|
public function wx_login_mobile(){
|
|
|
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$this->appkey2.'&secret='.$this->appsecret2;
|
|
|
$code = $this->request->get('code');
|
|
|
var_dump($code);exit;
|
|
|
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$this->appkey1.'&secret='.$this->appsecret1.'&code='.$code.'&grant_type=authorization_code';
|
|
|
$res = $this->http_get($url);
|
|
|
$json_arr = json_decode($res,true);
|
|
|
|
|
|
if(!isset($json_arr['access_token'])&&empty($json_arr['access_token'])){
|
|
|
//用户取消登录
|
|
|
$this->redirect('/portal/login/thirdLogin');
|
|
|
}
|
|
|
$token = $json_arr['access_token'];
|
|
|
$openid = 'oYOYl5hbULoKimG5R8Uk-Paha0d8';
|
|
|
$openid = $json_arr['openid'];
|
|
|
//通过access_token获取用户信息
|
|
|
$url1 = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$token.'&openid='.$openid.'&lang=zh_CN';
|
|
|
$url1 = 'https://api.weixin.qq.com/sns/userinfo?access_token='.$token.'&openid='.$openid;
|
|
|
$res1 = $this->http_get($url1);
|
|
|
$info = json_decode($res1,true);
|
|
|
var_dump($info);exit;
|
...
|
...
|
|