| @@ 44-53 (lines=10) @@ | ||
| 41 | /** |
|
| 42 | * {@inheritdoc}. |
|
| 43 | */ |
|
| 44 | protected function getUserByToken(AccessTokenInterface $token) |
|
| 45 | { |
|
| 46 | $response = $this->getHttpClient()->get('https://api.douban.com/v2/user/~me', [ |
|
| 47 | 'headers' => [ |
|
| 48 | 'Authorization' => 'Bearer '.$token->getToken(), |
|
| 49 | ], |
|
| 50 | ]); |
|
| 51 | ||
| 52 | return json_decode($response->getBody()->getContents(), true); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * {@inheritdoc}. |
|
| @@ 157-167 (lines=11) @@ | ||
| 154 | * |
|
| 155 | * @return mixed |
|
| 156 | */ |
|
| 157 | protected function getUserInfo(AccessTokenInterface $token) |
|
| 158 | { |
|
| 159 | $response = $this->getHttpClient()->get('https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo', [ |
|
| 160 | 'query' => array_filter([ |
|
| 161 | 'access_token' => $token->getToken(), |
|
| 162 | 'code' => $this->getCode(), |
|
| 163 | ]), |
|
| 164 | ]); |
|
| 165 | ||
| 166 | return json_decode($response->getBody(), true); |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Get user detail info. |
|
| @@ 177-189 (lines=13) @@ | ||
| 174 | * |
|
| 175 | * @return mixed |
|
| 176 | */ |
|
| 177 | protected function getUserDetail(AccessTokenInterface $token, $ticket) |
|
| 178 | { |
|
| 179 | $response = $this->getHttpClient()->post('https://qyapi.weixin.qq.com/cgi-bin/user/getuserdetail', [ |
|
| 180 | 'query' => [ |
|
| 181 | 'access_token' => $token->getToken(), |
|
| 182 | ], |
|
| 183 | 'json' => [ |
|
| 184 | 'user_ticket' => $ticket, |
|
| 185 | ], |
|
| 186 | ]); |
|
| 187 | ||
| 188 | return json_decode($response->getBody(), true); |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * @param array $user |
|
| @@ 52-63 (lines=12) @@ | ||
| 49 | /** |
|
| 50 | * {@inheritdoc} |
|
| 51 | */ |
|
| 52 | protected function getUserByToken(AccessTokenInterface $token) |
|
| 53 | { |
|
| 54 | $response = $this->getHttpClient()->get( |
|
| 55 | 'https://graph.microsoft.com/v1.0/me', |
|
| 56 | ['headers' => [ |
|
| 57 | 'Accept' => 'application/json', |
|
| 58 | 'Authorization' => 'Bearer ' . $token->getToken(), |
|
| 59 | ], |
|
| 60 | ]); |
|
| 61 | ||
| 62 | return json_decode($response->getBody()->getContents(), true); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * {@inheritdoc} |
|