/** * 第三方帐号登陆和绑定 */ public function index() { $mod = $this->_get('mod', 'trim'); $type = $this->_get('type', 'trim', 'login'); !$mod && $this->_404(); if ('unbind' == $type) { !$this->visitor->is_login && $this->redirect('user/login'); M('user_bind')->where(array('uid' => $this->visitor->info['id'], 'type' => $mod))->delete(); $this->redirect('user/bind'); } $oauth = new oauth($mod); cookie('callback_type', $type); return $oauth->authorize(); }