GoodsTwoCate.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace app\mall\controller;
  3. use library\Controller;
  4. use library\service\MenuService;
  5. use library\tools\Data;
  6. use think\Db;
  7. /**
  8. * 二级分类管理
  9. * Class GoodsCate
  10. * @package app\admin\controller
  11. */
  12. class GoodsTwoCate extends Controller
  13. {
  14. /**
  15. * 当前操作数据库
  16. * @var string
  17. */
  18. protected $table = 'GoodsCate';
  19. /**
  20. * 二级分类管理
  21. * @auth true
  22. * @menu true
  23. * @throws \think\Exception
  24. * @throws \think\db\exception\DataNotFoundException
  25. * @throws \think\db\exception\ModelNotFoundException
  26. * @throws \think\exception\DbException
  27. * @throws \think\exception\PDOException
  28. */
  29. public function index()
  30. {
  31. $this->title = '二级分类管理';
  32. $id = input('id');
  33. if(empty($id)){
  34. $this->error('非法操作');
  35. }
  36. $query = $this->_query($this->table)->like('title');
  37. $query->where('level',2)->where('pid',$id)->where('is_deleted',0)->order('id asc')->page();
  38. }
  39. /**
  40. * 列表数据处理
  41. * @param array $data
  42. */
  43. protected function _index_page_filter(&$data)
  44. {
  45. }
  46. /**
  47. * 添加分类
  48. * @auth true
  49. * @menu true
  50. * @throws \think\Exception
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. * @throws \think\exception\DbException
  54. * @throws \think\exception\PDOException
  55. */
  56. public function add()
  57. {
  58. $this->_form($this->table, 'form');
  59. }
  60. /**
  61. * 编辑分类
  62. * @auth true
  63. * @menu true
  64. * @throws \think\Exception
  65. * @throws \think\db\exception\DataNotFoundException
  66. * @throws \think\db\exception\ModelNotFoundException
  67. * @throws \think\exception\DbException
  68. * @throws \think\exception\PDOException
  69. */
  70. public function edit()
  71. {
  72. $this->_form($this->table, 'form');
  73. }
  74. /**
  75. * 表单数据处理
  76. * @param array $vo
  77. * @throws \ReflectionException
  78. * @throws \think\db\exception\DataNotFoundException
  79. * @throws \think\db\exception\ModelNotFoundException
  80. * @throws \think\exception\DbException
  81. */
  82. protected function _form_filter(&$vo)
  83. {
  84. if ($this->request->isGet()) {
  85. }
  86. if($this->request->isPost() && in_array($this->request->action(),['add','edit'])){
  87. }
  88. }
  89. /**
  90. * 启用
  91. * @auth true
  92. * @menu true
  93. * @throws \ReflectionException
  94. * @throws \think\db\exception\DataNotFoundException
  95. * @throws \think\db\exception\ModelNotFoundException
  96. * @throws \think\exception\DbException
  97. */
  98. public function enable()
  99. {
  100. $this->_save($this->table, ['status' => '1']);
  101. }
  102. /**
  103. * 禁用
  104. * @auth true
  105. * @menu true
  106. * @throws \ReflectionException
  107. * @throws \think\db\exception\DataNotFoundException
  108. * @throws \think\db\exception\ModelNotFoundException
  109. * @throws \think\exception\DbExceptionn
  110. */
  111. public function forbidden()
  112. {
  113. $this->_save($this->table, ['status' => '0']);
  114. }
  115. /**
  116. * 删除
  117. * @auth true
  118. * @menu true
  119. * @throws \ReflectionException
  120. * @throws \think\db\exception\DataNotFoundException
  121. * @throws \think\db\exception\ModelNotFoundException
  122. * @throws \think\exception\DbException
  123. */
  124. public function remove()
  125. {
  126. $this->_delete($this->table);
  127. }
  128. }