public function main() { $token = $this->getString($this->params, 'token', ''); $uid = $this->getString($this->params, 'uid', ''); if (common\Utils::checkToken($uid, $token)) { return array('_view_mode' => 'Php', '_tpl_file' => 'index.php', 'uid' => $uid, 'token' => $token, 'static_url' => ZConfig::getField('project', 'static_url'), 'app_host' => ZConfig::getField('project', 'app_host')); } return array('_view_mode' => 'Php', '_tpl_file' => 'login.php', 'static_url' => ZConfig::getField('project', 'static_url')); }
public function main() { $token = $this->getString($this->params, 'token', ''); $uid = $this->getString($this->params, 'uid', ''); if (common\Utils::checkToken($uid, $token)) { return array('uid' => $uid, 'token' => $token, 'static_url' => ZConfig::getField('project', 'static_url'), 'app_host' => ZConfig::getField('project', 'app_host')); } return common\Utils::jump("main", "login", array("msg" => "需要登录")); }
public function check() { $uid = $this->getInteger($this->params, 'uid'); $token = $this->getString($this->params, 'token'); if (common\Utils::checkToken($uid, $token)) { $uinfo = common\loadClass::getService('User')->fetchById($uid); if (!empty($uinfo)) { return $uinfo->hash(); } return false; } return false; }
public function check($uid, $token) { $fd = Request::getFd(); if (common\Utils::checkToken($uid, $token)) { $uinfo = common\loadClass::getService('User')->fetchById($uid); if (!empty($uinfo)) { //登录成功 $oinfo = $this->getConn()->get($uinfo->id); if (!empty($oinfo)) { $this->sendOne($oinfo['fd'], common\Cmd::RELOGIN, []); $this->getConn()->delete($oinfo['fd'], $uid); $this->close($oinfo['fd']); } $this->getConn()->add($uid, $fd); $this->getConn()->addFd($fd, $uid); $this->sendToChannel(common\Cmd::LOGIN_SUCC, $uinfo->hash()); return null; } } $this->sendOne(Request::getFd(), common\Cmd::LOGIN_ERROR); Request::getSocket()->close($fd); }