GoodsCate.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | framework
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://framework.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/framework
  12. // +----------------------------------------------------------------------
  13. namespace app\store\controller;
  14. use library\Controller;
  15. /**
  16. * 商品分类管理
  17. * Class GoodsCate
  18. * @package app\store\controller
  19. */
  20. class GoodsCate extends Controller
  21. {
  22. /**
  23. * 绑定数据表
  24. * @var string
  25. */
  26. protected $table = 'StoreGoodsCate';
  27. /**
  28. * 商品分类管理
  29. * @throws \think\Exception
  30. * @throws \think\db\exception\DataNotFoundException
  31. * @throws \think\db\exception\ModelNotFoundException
  32. * @throws \think\exception\DbException
  33. * @throws \think\exception\PDOException
  34. */
  35. public function index()
  36. {
  37. $this->title = '商品分类管理';
  38. $where = ['is_deleted' => '0'];
  39. $this->_query($this->table)->like('title')->equal('status')->where($where)->order('sort asc,id desc')->page();
  40. }
  41. /**
  42. * 添加商品分类
  43. * @return mixed
  44. */
  45. public function add()
  46. {
  47. $this->title = '添加商品分类';
  48. return $this->_form($this->table, 'form');
  49. }
  50. /**
  51. * 编辑添加商品分类
  52. * @return mixed
  53. */
  54. public function edit()
  55. {
  56. $this->title = '编辑商品分类';
  57. return $this->_form($this->table, 'form');
  58. }
  59. /**
  60. * 禁用添加商品分类
  61. */
  62. public function forbid()
  63. {
  64. $this->_save($this->table, ['status' => '0']);
  65. }
  66. /**
  67. * 启用商品分类
  68. */
  69. public function resume()
  70. {
  71. $this->_save($this->table, ['status' => '1']);
  72. }
  73. /**
  74. * 删除商品分类
  75. */
  76. public function remove()
  77. {
  78. $this->_delete($this->table);
  79. }
  80. }