@@ -33,7 +33,7 @@ |
||
| 33 | 33 | if($_GET['scope'] == 'snsapi_login'){ |
| 34 | 34 | //扫码登录 |
| 35 | 35 | $AuthorizeURL = $this->AuthorizeURL . '/connect/qrconnect'; |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $AuthorizeURL = $this->AuthorizeURL . '/connect/oauth2/authorize'; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | throw new \Exception("Facebook APP登录 需要传输access_token参数! "); |
| 83 | 83 | } |
| 84 | 84 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 85 | - }else { |
|
| 85 | + } else { |
|
| 86 | 86 | $this->getToken(); |
| 87 | 87 | } |
| 88 | 88 | $fields = isset($this->config['fields']) ? $this->config['fields'] : 'id,name,gender,picture.width(400)'; |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | throw new \Exception("Wechat APP登录 需要传输access_token参数! "); |
| 116 | 116 | } |
| 117 | 117 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 118 | - }else { |
|
| 118 | + } else { |
|
| 119 | 119 | /** 获取token信息 */ |
| 120 | 120 | $this->getToken(); |
| 121 | 121 | } |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | throw new \Exception("腾讯QQ,APP登录 需要传输access_token参数! "); |
| 102 | 102 | } |
| 103 | 103 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 104 | - }else{ |
|
| 104 | + } else{ |
|
| 105 | 105 | /** 获取token */ |
| 106 | 106 | $this->getToken(); |
| 107 | 107 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/douyin-default-get-permission-code |
| 65 | 65 | */ |
| 66 | 66 | return $this->AuthorizeSilenceURL . '?' . http_build_query($params); |
| 67 | - }else{ |
|
| 67 | + } else{ |
|
| 68 | 68 | return $this->AuthorizeURL . '?' . http_build_query($params); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | throw new \Exception("Douyin APP登录 需要传输access_token参数! "); |
| 128 | 128 | } |
| 129 | 129 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 130 | - }elseif ($this->type == 'applets'){ |
|
| 130 | + } elseif ($this->type == 'applets'){ |
|
| 131 | 131 | //小程序 |
| 132 | 132 | return $this->applets(); |
| 133 | - }else { |
|
| 133 | + } else { |
|
| 134 | 134 | /** 获取token信息 */ |
| 135 | 135 | $this->getToken(); |
| 136 | 136 | } |
@@ -207,8 +207,12 @@ discard block |
||
| 207 | 207 | 'appid' => $this->config['app_id'], |
| 208 | 208 | 'secret' => $this->config['app_secret'], |
| 209 | 209 | ]; |
| 210 | - if(isset($_REQUEST['code'])) $params['code'] = $_REQUEST['code']; |
|
| 211 | - if(isset($_REQUEST['anonymous_code'])) $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
| 210 | + if(isset($_REQUEST['code'])) { |
|
| 211 | + $params['code'] = $_REQUEST['code']; |
|
| 212 | + } |
|
| 213 | + if(isset($_REQUEST['anonymous_code'])) { |
|
| 214 | + $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
| 215 | + } |
|
| 212 | 216 | |
| 213 | 217 | return $params; |
| 214 | 218 | } |
@@ -226,7 +230,7 @@ discard block |
||
| 226 | 230 | $data = json_decode($token, true); |
| 227 | 231 | if (isset($data['data']['access_token'])) { |
| 228 | 232 | return $data['data']; |
| 229 | - }elseif (isset($data['session_key'])){ |
|
| 233 | + } elseif (isset($data['session_key'])){ |
|
| 230 | 234 | //小程序登录 |
| 231 | 235 | return $data; |
| 232 | 236 | } else { |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | } |
| 81 | 81 | $this->token['token_type'] = 'Bearer'; |
| 82 | 82 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 83 | - }else { |
|
| 83 | + } else { |
|
| 84 | 84 | $this->getToken(); |
| 85 | 85 | } |
| 86 | 86 | $data = $this->call('nid/me', $this->token, 'GET'); |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | } |
| 95 | 95 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 96 | 96 | $this->token['openid'] = $_REQUEST['uid']; |
| 97 | - }else{ |
|
| 97 | + } else{ |
|
| 98 | 98 | /** 获取参数 */ |
| 99 | 99 | $params = $this->accessTokenParams(); |
| 100 | 100 | $this->AccessTokenURL = $this->AccessTokenURL. '?' . http_build_query($params);//get传参 |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | throw new \Exception("Wechat APP登录 需要传输access_token参数! "); |
| 132 | 132 | } |
| 133 | 133 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 134 | - }elseif ($this->type == 'applets'){ |
|
| 134 | + } elseif ($this->type == 'applets'){ |
|
| 135 | 135 | //小程序 |
| 136 | 136 | return $this->applets(); |
| 137 | - }else { |
|
| 137 | + } else { |
|
| 138 | 138 | /** 获取token信息 */ |
| 139 | 139 | $this->getToken(); |
| 140 | 140 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $data = json_decode($token, true); |
| 216 | 216 | if (isset($data['access_token'])) { |
| 217 | 217 | return $data; |
| 218 | - }elseif (isset($data['session_key'])){ |
|
| 218 | + } elseif (isset($data['session_key'])){ |
|
| 219 | 219 | //小程序登录 |
| 220 | 220 | return $data; |
| 221 | 221 | } else { |
@@ -99,7 +99,9 @@ |
||
| 99 | 99 | ]; |
| 100 | 100 | $this->config = array_merge($_config, $config); |
| 101 | 101 | foreach($this->config as $key=>$val){ |
| 102 | - if(property_exists($this,$key)) $this->$key=$val; |
|
| 102 | + if(property_exists($this,$key)) { |
|
| 103 | + $this->$key=$val; |
|
| 104 | + } |
|
| 103 | 105 | } |
| 104 | 106 | $this->timestamp = time(); |
| 105 | 107 | } |