修正后台错误

This commit is contained in:
1099438829 2021-06-13 22:50:40 +08:00
parent 1e51b08807
commit 8dfa7bbd04
4 changed files with 20 additions and 4 deletions

View File

@ -25,6 +25,8 @@ class Index extends AuthController
cache(AdminAuth::getMenuCacheKey($this->adminId),$menuList,1*60*60);
}
$this->assign("menu",$menuList);
$message = ['data'=>[],'count'=>0];
$this->assign("message",$message);
return $this->fetch();
}

View File

@ -61,6 +61,8 @@ class Admin extends BaseModel
*/
public static function setLoginInfo($info)
{
unset($info->pwd);//去除密码字段
$info->role_auth = AdminRole::getAuth($info['role_id'] ?? 0);//提前缓存auth字段避免频繁查询
Session::set("adminId",$info['id']);
Session::set("adminInfo",$info->toArray());
event("AdminLog",[$info->toArray(),"admin","login","login"]);
@ -132,6 +134,7 @@ class Admin extends BaseModel
$model = $model->where("id",$id);
$model = $model->field($field);
$info = $model->find();
unset($info->pwd);
return $info ? $info->toArray() : [];
}

View File

@ -52,6 +52,17 @@ class AdminAuth extends BaseModel
return $data->toArray() ?: [];
}
/**
* 获取菜单列表缓存key
* @param $adminId
* @return string
* @author 李玉坤
* @date 2021-06-09 17:24
*/
public static function getMenuCacheKey($adminId){
return 'menu:List:'.$adminId;
}
/**
* 权限列表
* @param $where