Nav.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\web;
  12. use app\service\admin\web\NavService;
  13. use core\base\BaseAdminController;
  14. use think\Response;
  15. /**
  16. * 电脑端导航
  17. * Class Nav
  18. * @package app\adminapi\controller\web
  19. */
  20. class Nav extends BaseAdminController
  21. {
  22. /**
  23. * 获取首页导航分页列表
  24. * @return \think\Response
  25. */
  26. public function pages()
  27. {
  28. $data = $this->request->params([
  29. [ "nav_title", "" ],
  30. ]);
  31. return success(( new NavService() )->getPage($data));
  32. }
  33. /**
  34. * 获取首页导航列表
  35. * @return \think\Response
  36. */
  37. public function lists()
  38. {
  39. $data = $this->request->params([
  40. [ "nav_title", "" ]
  41. ]);
  42. return success(( new NavService() )->getList($data));
  43. }
  44. /**
  45. * 首页导航详情
  46. * @param int $id
  47. * @return \think\Response
  48. */
  49. public function info(int $id)
  50. {
  51. return success(( new NavService() )->getInfo($id));
  52. }
  53. /**
  54. * 添加首页导航
  55. * @return \think\Response
  56. */
  57. public function add()
  58. {
  59. $data = $this->request->params([
  60. [ "nav_title", "" ],
  61. [ "nav_url", "" ],
  62. [ "sort", "" ],
  63. [ "is_blank", "" ],
  64. [ "nav_icon", "" ],
  65. [ "is_show", "" ],
  66. ]);
  67. $id = ( new NavService() )->add($data);
  68. return success('ADD_SUCCESS', [ 'id' => $id ]);
  69. }
  70. /**
  71. * 首页导航编辑
  72. * @param $id 首页导航id
  73. * @return \think\Response
  74. */
  75. public function edit($id)
  76. {
  77. $data = $this->request->params([
  78. [ "nav_title", "" ],
  79. [ "nav_url", "" ],
  80. [ "sort", "" ],
  81. [ "is_blank", "" ],
  82. [ "nav_icon", "" ],
  83. [ "is_show", "" ],
  84. ]);
  85. ( new NavService() )->edit($id, $data);
  86. return success('EDIT_SUCCESS');
  87. }
  88. /**
  89. * 首页导航删除
  90. * @param int $id 首页导航id
  91. * @return Response
  92. */
  93. public function del(int $id)
  94. {
  95. ( new NavService() )->del($id);
  96. return success('DELETE_SUCCESS');
  97. }
  98. }