menuCache->getMenu(); return $this->return->success('success', ['list' => $data]); } public function add() { return $this->return->success(); } public function edit() { return $this->return->success(); } public function del() { return $this->return->success(); } /** * 详情 * @return array */ public function details(): array { $menuId = $this->request->input('menu_id'); $res = $this->adminMenuModel->where('id',$menuId)->first(); if (!$res) throw new AdminException('角色不存在'); $res = $res->toArray(); //闭包函数获取子集 $res = function() use($res,$menuId) { $children = $this->adminMenuModel->where('parent_id',$menuId)->select(['type','value','title','id'])->get(); $res['permissionList'] = []; if (!empty($children)) { $children = $children->toArray(); if ($children[0]['type'] == AuthCode::MENU_TYPE_LIST) { return $res; } foreach ($children as $one) { $res['permissionList'][] = [ 'id' => $one['id'], 'label' => $one['title'], 'value' => $one['value'], ]; } } return $res; }; return $this->return->success('success',['info' => $res]); } }