GoodsCate.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 GoodsCate 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. $query = $this->_query($this->table)->like('title');
  33. $query->where('level',1)->where('is_deleted',0)->order('id asc')->page();
  34. }
  35. /**
  36. * 列表数据处理
  37. * @param array $data
  38. */
  39. protected function _index_page_filter(&$data)
  40. {
  41. }
  42. /**
  43. * 添加分类
  44. * @auth true
  45. * @menu true
  46. * @throws \think\Exception
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\ModelNotFoundException
  49. * @throws \think\exception\DbException
  50. * @throws \think\exception\PDOException
  51. */
  52. public function add()
  53. {
  54. $this->_form($this->table, 'form');
  55. }
  56. /**
  57. * 编辑分类
  58. * @auth true
  59. * @menu true
  60. * @throws \think\Exception
  61. * @throws \think\db\exception\DataNotFoundException
  62. * @throws \think\db\exception\ModelNotFoundException
  63. * @throws \think\exception\DbException
  64. * @throws \think\exception\PDOException
  65. */
  66. public function edit()
  67. {
  68. $this->_form($this->table, 'form');
  69. }
  70. /**
  71. * 表单数据处理
  72. * @param array $vo
  73. * @throws \ReflectionException
  74. * @throws \think\db\exception\DataNotFoundException
  75. * @throws \think\db\exception\ModelNotFoundException
  76. * @throws \think\exception\DbException
  77. */
  78. protected function _form_filter(&$vo)
  79. {
  80. if ($this->request->isGet()) {
  81. }
  82. if($this->request->isPost() && in_array($this->request->action(),['add','edit'])){
  83. }
  84. }
  85. /**
  86. * 启用
  87. * @auth true
  88. * @menu true
  89. * @throws \ReflectionException
  90. * @throws \think\db\exception\DataNotFoundException
  91. * @throws \think\db\exception\ModelNotFoundException
  92. * @throws \think\exception\DbException
  93. */
  94. public function enable()
  95. {
  96. $this->_save($this->table, ['status' => '1']);
  97. }
  98. /**
  99. * 禁用
  100. * @auth true
  101. * @menu true
  102. * @throws \ReflectionException
  103. * @throws \think\db\exception\DataNotFoundException
  104. * @throws \think\db\exception\ModelNotFoundException
  105. * @throws \think\exception\DbExceptionn
  106. */
  107. public function forbidden()
  108. {
  109. $this->_save($this->table, ['status' => '0']);
  110. }
  111. /**
  112. * 删除
  113. * @auth true
  114. * @menu true
  115. * @throws \ReflectionException
  116. * @throws \think\db\exception\DataNotFoundException
  117. * @throws \think\db\exception\ModelNotFoundException
  118. * @throws \think\exception\DbException
  119. */
  120. public function remove()
  121. {
  122. $this->_delete($this->table);
  123. }
  124. }