mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 11:59:16 +08:00
微信/QQ支付返回参数优化
This commit is contained in:
parent
82da920b54
commit
922b03237b
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user