public function sinaCallbackAction() { try { $wb = new WbApi($this->di); $accessToken = $wb->getAccessToken(); //获取的uid $wb_uid = $wb->getUid(); $uids = $wb_uid['uid']; if ($this->session->has('uid') && !empty($uids)) { $user = new Users(); if ($user->getUinfo($uids, 'wb')) { echo '<script>alert("绑定失败,该账号已绑定其他用户");window.location.href="/user/accountbind";</script>'; return; } else { if ($user->bingWb($this->session->get('uid'), $uids)) { $this->response->redirect('user/accountbind'); } else { throw new E('WB bing failed'); } } } else { $user = new Users(); if ($uinfo = $user->getUinfo($uids, 'wb')) { $cas = new \Ucenter\Utils\cas\CAServer(); $this->session->set('uid', $uinfo['u_id']); $this->session->set('uinfo', array('name' => $uinfo['u_name'], 'mobile' => $uinfo['u_mobi'])); $cas->casSave(0, 0); $this->response->redirect('user/index'); } else { //获取用户信息 $uidInfo = $wb->getUserInfoByUid($uids); $info = array('type' => 'wb', 'name' => $uidInfo['name'], 'uids' => $uids, 'pic' => $uidInfo['profile_image_url']); setcookie(substr(md5('tmpQqWb'), 8, 20), base64_encode(json_encode($info)), $_SERVER['REQUEST_TIME'] + 1800, '/'); $this->response->redirect('index/addUserInfo'); } } } catch (E $e) { $this->response->redirect('login'); } }