Authored by hf

modify qq login

... ... @@ -206,13 +206,18 @@ class LoginController extends AbstractAction
public function qqcallbackAction()
{
$qqconnect = Factory::create('qqconnect');
$access = $qqconnect->getAccessToken();
echo 'did1';
$access = $qqconnect->getAccessToken(); var_dump($access);
echo 'did2';
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
$partnerInfo = $qqconnect->getUserInfo($access); var_dump($partnerInfo);
$result = array();
if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) {
echo 'did3';
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
}
echo 'did4';
var_dump($result);
$refer = $this->getCookie('refer');
if (empty($refer)) {
... ... @@ -222,11 +227,15 @@ class LoginController extends AbstractAction
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
echo 'did5';
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
echo 'did6';
$this->setSession('_TOKEN', $token);
echo 'did7';
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
echo 'did8';
$this->go($refer);
}
}
... ...