...
|
...
|
@@ -4,6 +4,9 @@ namespace app\api\controller; |
|
|
|
|
|
use app\admin\controller\Base;
|
|
|
use app\admin\model\Manager as ManagerModel;
|
|
|
use app\admin\model\Menu as MenuModel;
|
|
|
use app\admin\model\Role as RoleModel;
|
|
|
use think\Cache;
|
|
|
use think\Validate;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -159,4 +162,23 @@ class Manager extends Base |
|
|
$this->response('成功',200,[]);;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @name :获取当前用户菜单列表
|
|
|
* @return void
|
|
|
* @author :liyuhang
|
|
|
* @method : get
|
|
|
*/
|
|
|
public function get_menu(){
|
|
|
//获取当前用户角色
|
|
|
$roleModel = new RoleModel();
|
|
|
$role_info = $roleModel->read(['id'=>$this->user['role_id']]);
|
|
|
//根据当前角色获取当前菜单栏
|
|
|
$menuModel = new MenuModel();
|
|
|
$menu_lists = $menuModel->where(['pid'=>0,'status'=>1,'deleted'=>1])->where('id','in',$role_info['menu'])->select()->toArray();
|
|
|
foreach ($menu_lists as $k => $v){
|
|
|
$menu_lists[$k]['son'] = $menuModel->where(['pid'=>$v['id'],'status'=>1,'deleted'=>1])->where('id','in',$role_info['menu'])->select()->toArray();
|
|
|
}
|
|
|
$this->response('当前用户菜单列表',200,$menu_lists);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|