From 922b03237b6e80e82a536449646a9a71f83dfaa4 Mon Sep 17 00:00:00 2001 From: Devil Date: Sun, 11 Apr 2021 23:36:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1/QQ=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=8F=82=E6=95=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/base/QQ.php | 4 ++-- extend/base/Wechat.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extend/base/QQ.php b/extend/base/QQ.php index c211d9cdd..cc4dfd63b 100644 --- a/extend/base/QQ.php +++ b/extend/base/QQ.php @@ -107,7 +107,7 @@ class QQ // 请求获取session_key $url = 'https://api.q.qq.com/sns/jscode2session?appid='.$this->_appid.'&secret='.$this->_appsecret.'&js_code='.$authcode.'&grant_type=authorization_code'; $result = $this->HttpRequestGet($url); - if(!empty($result['openid'])) + if(!empty($result) && !empty($result['openid'])) { // 从缓存获取用户信息 $key = 'qq_user_login_'.$result['openid']; @@ -143,7 +143,7 @@ class QQ // 网络请求 $url = 'https://api.q.qq.com/api/getToken?grant_type=client_credential&appid='.$this->_appid.'&secret='.$this->_appsecret; $result = $this->HttpRequestGet($url); - if(!empty($result['access_token'])) + if(!empty($result) && !empty($result['access_token'])) { // 缓存存储 $result['expires_in'] += time(); diff --git a/extend/base/Wechat.php b/extend/base/Wechat.php index 4bf68bef0..6af3af9dc 100755 --- a/extend/base/Wechat.php +++ b/extend/base/Wechat.php @@ -111,7 +111,7 @@ class Wechat // 请求获取session_key $url = 'https://api.weixin.qq.com/sns/jscode2session?appid='.$this->_appid.'&secret='.$this->_appsecret.'&js_code='.$params['authcode'].'&grant_type=authorization_code'; $result = $this->HttpRequestGet($url); - if(!empty($result['openid'])) + if(!empty($result) && !empty($result['openid'])) { // 缓存SessionKey $key = 'wechat_user_login_'.$result['openid']; @@ -279,7 +279,7 @@ class Wechat // 网络请求 $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$this->_appid.'&secret='.$this->_appsecret; $result = $this->HttpRequestGet($url); - if(!empty($result['access_token'])) + if(!empty($result) && !empty($result['access_token'])) { // 缓存存储 $result['expires_in'] += time(); @@ -315,7 +315,7 @@ class Wechat // 网络请求 $url = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token='.$access_token.'&type='.$type; $result = $this->HttpRequestGet($url); - if(!empty($result['ticket'])) + if(!empty($result) && !empty($result['ticket'])) { // 缓存存储 $result['expires_in'] += time();