|
|
@@ -39,15 +39,8 @@ class Weixin extends BaseController
|
|
|
$code = trim($request->get('code'));
|
|
|
$weixinA = new weixina;
|
|
|
$token = $weixinA->oauth_reuslt($code);
|
|
|
- try {
|
|
|
- $url = 'https://api.weixin.qq.com/sns/userinfo?access_token='. $token['access_token']. '&openid='. $token['openid']. '&lang=zh_CN';
|
|
|
- $res = json_decode(doRequest($url, [], null, false), true);
|
|
|
- if (isset($res['errcode']) && $res['errcode'] != 0) {
|
|
|
- return app('json')->fail($res['errmsg'] ?? $res['msg'] ?? '请求错误');
|
|
|
- }
|
|
|
- return $res;
|
|
|
- } catch (Exception $e) {
|
|
|
- return app('json')->fail($e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine()]);
|
|
|
+ if (!empty($token['access_token'])) {
|
|
|
+ $userInfo = $weixinA->userinfo($token['access_token']);
|
|
|
}
|
|
|
}
|
|
|
|