GoodsCate.php 2.8 KB

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