Commit 52063d70 authored by hujun's avatar hujun

登录失效提示

parent d9c95805
......@@ -217,13 +217,21 @@ class Basic extends Controller
public function userVerify(){
$this->lastLoginTime = Session::get("lastLoginTime");
if(empty($this->userName) || empty($this->userId) || empty($this->lastLoginTime) ){
$this->redirect('/index/login');
if ($this->request->isAjax()) {
echo json_encode(array( "code" => "101", "msg" => "登录失效,请重新登录", "data" => [], "type" => "json" ));exit;
} else {
$this->redirect('/index/login');
}
}
$time = time();
//登录有效期为2小时
if (($time - $this->lastLoginTime) > 36000) {
$this->redirect('/index/login');
if ($this->request->isAjax()) {
echo json_encode(array( "code" => "101", "msg" => "登录失效,请重新登录", "data" => [], "type" => "json" ));exit;
} else {
$this->redirect('/index/login');die;
}
} else {
//更新时间
Session::set("lastLoginTime", $time);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment