@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |
@@ -21,21 +21,21 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class Douyin extends Gateway |
| 23 | 23 | { |
| 24 | - protected $ApiBase = 'https://open.douyin.com'; |
|
| 24 | + protected $ApiBase = 'https://open.douyin.com'; |
|
| 25 | 25 | protected $AuthorizeURL = 'https://open.douyin.com/platform/oauth/connect/'; |
| 26 | - protected $AuthorizeSilenceURL = 'https://open.douyin.com/oauth/authorize/v2/';//抖音静默授权 |
|
| 26 | + protected $AuthorizeSilenceURL = 'https://open.douyin.com/oauth/authorize/v2/'; //抖音静默授权 |
|
| 27 | 27 | protected $AccessTokenURL = 'oauth/access_token/'; |
| 28 | 28 | protected $UserInfoURL = 'oauth/userinfo/'; |
| 29 | 29 | |
| 30 | 30 | protected $jsCode2Session = 'https://minigame.zijieapi.com/mgplatform/api/apps/jscode2session'; |
| 31 | 31 | |
| 32 | 32 | protected $API_BASE_ARRAY = [ |
| 33 | - 'douyin'=>'https://open.douyin.com/',//抖音 |
|
| 34 | - 'toutiao'=>'https://open.snssdk.com/',//头条 |
|
| 35 | - 'xigua'=>'https://open-api.ixigua.com/',//西瓜 |
|
| 33 | + 'douyin'=>'https://open.douyin.com/', //抖音 |
|
| 34 | + 'toutiao'=>'https://open.snssdk.com/', //头条 |
|
| 35 | + 'xigua'=>'https://open-api.ixigua.com/', //西瓜 |
|
| 36 | 36 | ]; |
| 37 | 37 | |
| 38 | - public $oauth_type = ConstCode::TYPE_DOUYIN;//抖音 |
|
| 38 | + public $oauth_type = ConstCode::TYPE_DOUYIN; //抖音 |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @param $config |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | 'redirect_uri' => $this->config['callback'], |
| 66 | 66 | 'response_type' => $this->config['response_type'], |
| 67 | 67 | 'scope' => $this->config['scope'], |
| 68 | - 'optionalScope' => $this->config['optionalScope']??'', |
|
| 68 | + 'optionalScope' => $this->config['optionalScope'] ?? '', |
|
| 69 | 69 | 'state' => $this->config['state'], |
| 70 | 70 | ]; |
| 71 | - if($params['state'] == 'login_id'){ |
|
| 71 | + if ($params['state'] == 'login_id') { |
|
| 72 | 72 | /** |
| 73 | 73 | * 抖音静默获取授权码 |
| 74 | 74 | * https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/douyin-default-get-permission-code |
| 75 | 75 | */ |
| 76 | - return $this->AuthorizeSilenceURL . '?' . http_build_query($params); |
|
| 77 | - }else{ |
|
| 78 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 76 | + return $this->AuthorizeSilenceURL.'?'.http_build_query($params); |
|
| 77 | + } else { |
|
| 78 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | 'access_token'=> $this->token['access_token'] ?? '', |
| 115 | 115 | 'union_id'=> $this->token['unionid'] ?? '', |
| 116 | 116 | 'channel' => $this->oauth_type, |
| 117 | - 'nickname'=> $result['nickname']??'', |
|
| 117 | + 'nickname'=> $result['nickname'] ?? '', |
|
| 118 | 118 | 'gender' => $result['gender'] ?? ConstCode::GENDER, |
| 119 | - 'avatar' => $result['avatar']??'', |
|
| 119 | + 'avatar' => $result['avatar'] ?? '', |
|
| 120 | 120 | ]; |
| 121 | - $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'],$this->type); |
|
| 121 | + $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'], $this->type); |
|
| 122 | 122 | return $userInfo; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getUserInfo() |
| 133 | 133 | { |
| 134 | - if($this->type == 'app'){//App登录 |
|
| 135 | - if(!isset($_REQUEST['access_token']) ){ |
|
| 134 | + if ($this->type == 'app') {//App登录 |
|
| 135 | + if (!isset($_REQUEST['access_token'])) { |
|
| 136 | 136 | throw new \Exception("Douyin APP登录 需要传输access_token参数! "); |
| 137 | 137 | } |
| 138 | 138 | $this->token['access_token'] = $_REQUEST['access_token']; |
| 139 | - }elseif ($this->type == 'applets'){ |
|
| 139 | + }elseif ($this->type == 'applets') { |
|
| 140 | 140 | //小程序 |
| 141 | 141 | return $this->applets(); |
| 142 | - }else { |
|
| 142 | + } else { |
|
| 143 | 143 | /** 获取token信息 */ |
| 144 | 144 | $this->getToken(); |
| 145 | 145 | } |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | * @return array|mixed|null |
| 159 | 159 | * @throws \Exception |
| 160 | 160 | */ |
| 161 | - public function applets(){ |
|
| 161 | + public function applets() { |
|
| 162 | 162 | /** 获取参数 */ |
| 163 | 163 | $params = $this->jscode2sessionParams(); |
| 164 | 164 | |
| 165 | 165 | /** 获取access_token */ |
| 166 | - $token = $this->get($this->jsCode2Session, $params); |
|
| 166 | + $token = $this->get($this->jsCode2Session, $params); |
|
| 167 | 167 | /** 解析token值(子类实现此方法) */ |
| 168 | 168 | $this->token = $this->parseToken($token); |
| 169 | 169 | return $this->token; |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | private function switchAccessTokenURL() |
| 178 | 178 | { |
| 179 | - switch ($this->oauth_type){ |
|
| 180 | - case ConstCode::TYPE_DOUYIN:$this->ApiBase = $this->API_BASE_ARRAY['douyin'];break; |
|
| 181 | - case ConstCode::TYPE_TOUTIAO:$this->ApiBase = $this->API_BASE_ARRAY['toutiao'];break; |
|
| 182 | - case ConstCode::TYPE_XIGUA:$this->ApiBase = $this->API_BASE_ARRAY['xigua'];break; |
|
| 179 | + switch ($this->oauth_type) { |
|
| 180 | + case ConstCode::TYPE_DOUYIN:$this->ApiBase = $this->API_BASE_ARRAY['douyin']; break; |
|
| 181 | + case ConstCode::TYPE_TOUTIAO:$this->ApiBase = $this->API_BASE_ARRAY['toutiao']; break; |
|
| 182 | + case ConstCode::TYPE_XIGUA:$this->ApiBase = $this->API_BASE_ARRAY['xigua']; break; |
|
| 183 | 183 | default:throw new \Exception("获取抖音 OAUTH_TYPE 参数出错:{$this->oauth_type}"); |
| 184 | 184 | } |
| 185 | 185 | $this->AccessTokenURL = $this->ApiBase.$this->AccessTokenURL; |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | 'appid' => $this->config['app_id'], |
| 217 | 217 | 'secret' => $this->config['app_secret'], |
| 218 | 218 | ]; |
| 219 | - if(isset($_REQUEST['code'])) $params['code'] = $_REQUEST['code']; |
|
| 220 | - if(isset($_REQUEST['anonymous_code'])) $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
| 219 | + if (isset($_REQUEST['code'])) $params['code'] = $_REQUEST['code']; |
|
| 220 | + if (isset($_REQUEST['anonymous_code'])) $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
| 221 | 221 | |
| 222 | 222 | return $params; |
| 223 | 223 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $data = json_decode($token, true); |
| 236 | 236 | if (isset($data['data']['access_token'])) { |
| 237 | 237 | return $data['data']; |
| 238 | - }elseif (isset($data['session_key'])){ |
|
| 238 | + }elseif (isset($data['session_key'])) { |
|
| 239 | 239 | //小程序登录 |
| 240 | 240 | return $data; |
| 241 | 241 | } else { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'scope' => $this->config['scope'], |
| 55 | 55 | 'display' => $this->display, |
| 56 | 56 | ]; |
| 57 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 57 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'nickname'=> $result['nickname'], |
| 77 | 77 | 'gender' => isset($result['gender']) ? $this->getGender($result['gender']) : ConstCode::GENDER, |
| 78 | 78 | 'avatar' => $result['figureurl_qq_2'] ? $result['figureurl_qq_2'] : $result['figureurl_qq_1'], |
| 79 | - 'birthday'=> date('Y-m-d',strtotime($result['year'])), |
|
| 79 | + 'birthday'=> date('Y-m-d', strtotime($result['year'])), |
|
| 80 | 80 | ]; |
| 81 | 81 | return $userInfo; |
| 82 | 82 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function openid() |
| 112 | 112 | { |
| 113 | - if($this->type == 'app'){//App登录 |
|
| 114 | - if(!isset($_REQUEST['access_token'])){ |
|
| 113 | + if ($this->type == 'app') {//App登录 |
|
| 114 | + if (!isset($_REQUEST['access_token'])) { |
|
| 115 | 115 | throw new \Exception("腾讯QQ,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 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if (isset($data['access_token'])) { |
| 142 | 142 | return $data; |
| 143 | 143 | } else { |
| 144 | - throw new \Exception("获取腾讯QQ ACCESS_TOKEN 出错:" . $token); |
|
| 144 | + throw new \Exception("获取腾讯QQ ACCESS_TOKEN 出错:".$token); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @return mixed|string |
| 153 | 153 | * @throws \Exception |
| 154 | 154 | */ |
| 155 | - private function getOpenID(){ |
|
| 155 | + private function getOpenID() { |
|
| 156 | 156 | $query = [ |
| 157 | 157 | 'access_token' => $this->token['access_token'] |
| 158 | 158 | ]; |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | $query['unionid'] = 1; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - $data = $this->get(self::API_BASE . 'oauth2.0/me',$query); |
|
| 165 | - $data = json_decode(trim(substr($data, 9), " );\n"), true); |
|
| 164 | + $data = $this->get(self::API_BASE.'oauth2.0/me', $query); |
|
| 165 | + $data = json_decode(trim(substr($data, 9), " );\n"), true); |
|
| 166 | 166 | if (isset($data['openid'])) { |
| 167 | 167 | return $data; |
| 168 | 168 | } else { |
| 169 | - throw new \Exception("获取用户openid出错:" . $data['error_description']); |
|
| 169 | + throw new \Exception("获取用户openid出错:".$data['error_description']); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * M代表男性,F代表女性 |
| 176 | 176 | * @param $gender |
| 177 | 177 | */ |
| 178 | - public function getGender($gender){ |
|
| 178 | + public function getGender($gender) { |
|
| 179 | 179 | return $gender == '男' ? ConstCode::GENDER_MAN : ConstCode::GENDER_WOMEN; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | 'scope' => $this->config['scope'], |
| 52 | 52 | 'state' => $this->config['state'], |
| 53 | 53 | 'display' => $this->display, |
| 54 | - 'allow_signup' => true,//是否会在OAuth流程中为未经身份验证的用户提供注册GitHub的选项。默认是true。false在策略禁止注册的情况下使用。 |
|
| 54 | + 'allow_signup' => true, //是否会在OAuth流程中为未经身份验证的用户提供注册GitHub的选项。默认是true。false在策略禁止注册的情况下使用。 |
|
| 55 | 55 | ]; |
| 56 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 56 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $headers = [ |
| 114 | 114 | 'User-Agent: '.$this->config['application_name'], |
| 115 | 115 | 'UserModel-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 ', |
| 116 | - 'Authorization: token ' . $this->token['access_token'], |
|
| 116 | + 'Authorization: token '.$this->token['access_token'], |
|
| 117 | 117 | 'Accept: application/json' |
| 118 | 118 | ]; |
| 119 | 119 | $response = $this->get($this->UserInfoURL, [], $headers); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'state' => $this->config['state'], |
| 40 | 40 | 'scope' => $this->config['scope'], |
| 41 | 41 | ]; |
| 42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
| 42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->openid(); |
| 80 | 80 | |
| 81 | 81 | $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
| 82 | - $data = $this->get($this->UserInfoURL, [],$headers); |
|
| 82 | + $data = $this->get($this->UserInfoURL, [], $headers); |
|
| 83 | 83 | return json_decode($data, true); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @author: JiaMeng <[email protected]> |
| 102 | 102 | * Updater: |
| 103 | 103 | */ |
| 104 | - protected function getToken(){ |
|
| 104 | + protected function getToken() { |
|
| 105 | 105 | if (empty($this->token)) { |
| 106 | 106 | /** 验证state参数 */ |
| 107 | 107 | $this->CheckState(); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $params = $this->accessTokenParams(); |
| 111 | 111 | |
| 112 | 112 | /** 获取access_token */ |
| 113 | - $this->AccessTokenURL = $this->AccessTokenURL . '?' . http_build_query($params); |
|
| 114 | - $token = $this->post($this->AccessTokenURL); |
|
| 113 | + $this->AccessTokenURL = $this->AccessTokenURL.'?'.http_build_query($params); |
|
| 114 | + $token = $this->post($this->AccessTokenURL); |
|
| 115 | 115 | /** 解析token值(子类实现此方法) */ |
| 116 | 116 | $this->token = $this->parseToken($token); |
| 117 | 117 | } |