|
@@ -9,25 +9,35 @@ class Action extends BaseController{
|
|
|
public function __construct(App $app) {parent::__construct($app);}
|
|
|
|
|
|
//获取素有菜单列表数据
|
|
|
- public function index(){
|
|
|
- $post=$this->request->post();
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ $post = $this->request->post();
|
|
|
|
|
|
- $where=[["status","=",1],["is_del","=",0],["level",">=",$post["level"]??1],['menu_type',"=",2]];
|
|
|
- $data = Db::name("admin_menu")->where($where)->order("weight desc")->column("id,menu_name,menu_img,menu_route,menu_url,pid,level,is_show,is_private,menu_type,status");
|
|
|
+ $where = [["status", "=", 1], ["is_del", "=", 0], ['menu_type', "=", 2]];
|
|
|
+
|
|
|
+ if (isset($post['level']) && $post['level'] !== '') $where[] = ['level', 'in', $post['level']];
|
|
|
+
|
|
|
+ $data = Db::name("admin_menu")
|
|
|
+ ->where($where)
|
|
|
+ ->order("weight desc")
|
|
|
+ ->column("id,menu_name,menu_img,menu_route,menu_url,pid,level,is_show,is_private,menu_type,status");
|
|
|
$result = [];
|
|
|
- if(empty($data)){
|
|
|
- return app_show(0,"获取成功",$result);
|
|
|
+ if (empty($data)) {
|
|
|
+ return app_show(0, "获取成功", $result);
|
|
|
}
|
|
|
- $list=[];
|
|
|
- $menu=[];
|
|
|
- foreach ($data as $k=>$value){
|
|
|
- $action = Db::name("action")->alias("a")->leftJoin("action_list b","a.action_code=b.action_code")->where
|
|
|
- (["menuid"=>$value['id'],"a.status"=>1,"a.is_del"=>0,"b.is_del"=>0])->column("a.id,a.action_code,b.action_name");
|
|
|
- if($value['menu_type']==2) $value['action']=$action;
|
|
|
- $list[]=$value;
|
|
|
+ $list = [];
|
|
|
+ $menu = [];
|
|
|
+ foreach ($data as $k => $value) {
|
|
|
+ $action = Db::name("action")
|
|
|
+ ->alias("a")
|
|
|
+ ->leftJoin("action_list b", "a.action_code=b.action_code")
|
|
|
+ ->where(["menuid" => $value['id'], "a.status" => 1, "a.is_del" => 0, "b.is_del" => 0])
|
|
|
+ ->column("a.id,a.action_code,b.action_name");
|
|
|
+ if ($value['menu_type'] == 2) $value['action'] = $action;
|
|
|
+ $list[] = $value;
|
|
|
}
|
|
|
- menuAction($list,$menu);
|
|
|
- return app_show(0,"获取成功",array_values($menu));
|
|
|
+ menuAction($list, $menu);
|
|
|
+ return app_show(0, "获取成功", array_values($menu));
|
|
|
}
|
|
|
|
|
|
public function ActionList(){
|