@@ -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)'; |
@@ -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 { |
@@ -52,18 +52,18 @@ |
||
52 | 52 | case self::TYPE_QQ: |
53 | 53 | if($type == 'app'){ |
54 | 54 | $typeConst = self::TYPE_QQ_APP;//qqApp |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $typeConst = $channel; |
57 | 57 | } |
58 | 58 | break; |
59 | 59 | case self::TYPE_WECHAT: |
60 | 60 | if($type == 'app'){ |
61 | 61 | $typeConst = self::TYPE_WECHAT_APP;//微信App |
62 | - }else if($type == 'applets'){ |
|
62 | + } else if($type == 'applets'){ |
|
63 | 63 | $typeConst = self::TYPE_WECHAT_APPLETS;//微信小程序 |
64 | - }else if(Tool::isWeiXin()){ |
|
64 | + } else if(Tool::isWeiXin()){ |
|
65 | 65 | $typeConst = self::TYPE_WECHAT_MOBILE;//微信mobile |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | $typeConst = $channel; |
68 | 68 | } |
69 | 69 | break; |
@@ -130,7 +130,7 @@ |
||
130 | 130 | throw new \Exception("AliPay APP登录 需要传输access_token参数! "); |
131 | 131 | } |
132 | 132 | $this->token['access_token'] = $_REQUEST['access_token']; |
133 | - }else { |
|
133 | + } else { |
|
134 | 134 | /** 获取token信息 */ |
135 | 135 | $this->getToken(); |
136 | 136 | } |
@@ -108,7 +108,9 @@ discard block |
||
108 | 108 | ]; |
109 | 109 | $this->config = array_merge($_config, $config); |
110 | 110 | foreach($this->config as $key=>$val){ |
111 | - if(property_exists($this,$key)) $this->$key=$val; |
|
111 | + if(property_exists($this,$key)) { |
|
112 | + $this->$key=$val; |
|
113 | + } |
|
112 | 114 | } |
113 | 115 | $this->timestamp = time(); |
114 | 116 | } |
@@ -246,7 +248,7 @@ discard block |
||
246 | 248 | $token = $this->POST($this->AccessTokenURL, $params); |
247 | 249 | /** 解析token值(子类实现此方法) */ |
248 | 250 | $this->token = $this->parseToken($token); |
249 | - }else{ |
|
251 | + } else{ |
|
250 | 252 | return $this->token; |
251 | 253 | } |
252 | 254 | } |