Commit 97262a2a authored by zfc's avatar zfc

后台登录改版

parent 56e0021e
...@@ -32,17 +32,20 @@ class Login extends Basic ...@@ -32,17 +32,20 @@ class Login extends Basic
} }
/** /**
* @return \think\response\View * @return \think\Response
* @throws \think\Exception * @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function loginVerify() public function loginVerify()
{ {
$name = $_POST["username"]; $name = $this->request->param("username");
$password = $_POST["passwd"]; $password = $this->request->param("passwd");
if (!isset($name) || !isset($password)) { if (!isset($name) || !isset($password)) {
return view("/login/login", [ "msg" => "用户名或密码不能为空" ]); return $this->response('100','用户名或密码不能为空');
} }
...@@ -59,14 +62,16 @@ class Login extends Basic ...@@ -59,14 +62,16 @@ class Login extends Basic
$list=$this->loginAgent->verifyUser($filed,$join,$where); $list=$this->loginAgent->verifyUser($filed,$join,$where);
// prt($list->toArray());//转化arr // prt($list->toArray());//转化arr
if(!$list){ if(!$list){
return view("/login/login", [ "msg" => "用户名或密码错误" ]); return $this->response('101','用户名或密码错误');
} }
if($list['g_status']=='1'){ if($list['g_status']=='1'){
return view("/login/login", [ "msg" => "用户所在角色组已冻结" ]); return $this->response('102','用户所在角色组已冻结');
} }
if($list['admin_off']!='0'||empty($list['rules'])){ if($list['admin_off']!='0'||empty($list['rules'])){
return view("/login/login", [ "msg" => "用户无后台访问权限" ]); return $this->response('103','用户无后台访问权限');
}else{ }else{
$rules=trim($list['rules'],','); $rules=trim($list['rules'],',');
//查询后台菜单 //查询后台菜单
...@@ -80,6 +85,10 @@ class Login extends Basic ...@@ -80,6 +85,10 @@ class Login extends Basic
} }
$nav2[$v->id]=$v; $nav2[$v->id]=$v;
} }
if(!$url){
return $this->response('104','用户无任何后台访模块问权限!');
}
//搜索菜单功能 //搜索菜单功能
$where = "id in({$rules}) and is_menu=0 and status=0 "; $where = "id in({$rules}) and is_menu=0 and status=0 ";
...@@ -111,8 +120,13 @@ class Login extends Basic ...@@ -111,8 +120,13 @@ class Login extends Basic
Session::set("lastLoginTime",time()); Session::set("lastLoginTime",time());
$this->operating_records($list["id"],1,'后台登陆'); //记录操作日志 $this->operating_records($list["id"],1,'后台登陆'); //记录操作日志
$data['url']=$url;
$data['data']=$list2;
if($this->request->isAjax()) {
return $this->response('200', '登录成功', $data);
}else {
$this->redirect('/admin.php/'.$url); $this->redirect('/admin.php/'.$url);
}
// } // }
......
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