Commit c22a206e authored by hujun's avatar hujun

管理员登录修改

parent 13df2d28
...@@ -74,8 +74,16 @@ class Login extends Basic ...@@ -74,8 +74,16 @@ class Login extends Basic
if($list['admin_off']!= '0'|| empty($list['rules']) || $list['status'] != '0') { if($list['admin_off']!= '0'|| empty($list['rules']) || $list['status'] != '0') {
return $this->response('103','无后台访问权限'); return $this->response('103','无后台访问权限');
}else{ }else{
$where_rule['status'] = 0;
if ($list['id'] == 1) {
//超级管理员
$nav = $this->authRule->getRule('',$where_rule);
} else {
$where_rule['id'] = ['in', $list['rules']];
//查询后台菜单 //查询后台菜单
$nav = $this->authRule->getRule($list['rules']); $nav = $this->authRule->getRule('', $list['rules']);
}
$menu_data = []; $menu_data = [];
$auth_data = []; $auth_data = [];
foreach ($nav as $k=>$v) { foreach ($nav as $k=>$v) {
......
...@@ -166,16 +166,18 @@ class AuthRule extends BaseModel ...@@ -166,16 +166,18 @@ class AuthRule extends BaseModel
} }
/** /**
* @param $id * 规则查询
*
* @param string $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getRule($id) { public function getRule($field = 'id,name,title,pid,is_menu', $where) {
return $this->field('id,name,title,pid,is_menu') return $this->field($field)
->where('status',0) ->where($where)
->where('id','in', $id)
->select(); ->select();
} }
} }
\ No newline at end of file
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