Menu.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. /**
  5. * Description of Menu
  6. *
  7. * @author sgq
  8. */
  9. class Menu extends AdminController {
  10. function index() {
  11. return view();
  12. }
  13. function add() {
  14. if ($this->request->isPost()) {
  15. }
  16. return view();
  17. }
  18. function edit() {
  19. if ($this->request->isPost()) {
  20. }
  21. return view();
  22. }
  23. function delete() {
  24. if ($this->request->isPost()) {
  25. }
  26. }
  27. /**
  28. * 树形
  29. * @return type
  30. */
  31. function treelist() {
  32. $id = $this->request->param("id");
  33. $list = getTreeList(\app\common\api\MenuApi::getPrivilagesByRoleid($id));
  34. $format_list = [];
  35. foreach ($list as $item) {
  36. $format_list[] = [
  37. "checked" => $item["checked"],
  38. "id" => $item["id"],
  39. "isOpen" => true,
  40. "name" => $item["name"],
  41. "open" => $item["pid"] == 0 ? true : false,
  42. "pId" => $item["pid"]
  43. ];
  44. }
  45. return $format_list;
  46. }
  47. }