Mark.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace app\data\controller\shop;
  3. use app\data\model\ShopGoodsMark;
  4. use think\admin\Controller;
  5. /**
  6. * 商品标签管理
  7. * Class Mark
  8. * @package app\data\controller\shop
  9. */
  10. class Mark extends Controller
  11. {
  12. /**
  13. * 商品标签管理
  14. * @auth true
  15. * @throws \think\db\exception\DataNotFoundException
  16. * @throws \think\db\exception\DbException
  17. * @throws \think\db\exception\ModelNotFoundException
  18. */
  19. public function index()
  20. {
  21. $this->title = '商品标签管理';
  22. $query = $this->_query(ShopGoodsMark::mk());
  23. $query->like('name')->dateBetween('create_at');
  24. $query->equal('status')->order('sort desc,id desc')->page();
  25. }
  26. /**
  27. * 商品标签选择
  28. * @login true
  29. * @throws \think\db\exception\DataNotFoundException
  30. * @throws \think\db\exception\DbException
  31. * @throws \think\db\exception\ModelNotFoundException
  32. */
  33. public function select()
  34. {
  35. $this->_query(ShopGoodsMark::mk())->order('sort desc,id desc')->page();
  36. }
  37. /**
  38. * 添加商品标签
  39. * @auth true
  40. * @throws \think\db\exception\DataNotFoundException
  41. * @throws \think\db\exception\DbException
  42. * @throws \think\db\exception\ModelNotFoundException
  43. */
  44. public function add()
  45. {
  46. $this->_form(ShopGoodsMark::mk(), 'form');
  47. }
  48. /**
  49. * 编辑商品标签
  50. * @auth true
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\DbException
  53. * @throws \think\db\exception\ModelNotFoundException
  54. */
  55. public function edit()
  56. {
  57. $this->_form(ShopGoodsMark::mk(), 'form');
  58. }
  59. /**
  60. * 修改商品标签状态
  61. * @auth true
  62. * @throws \think\db\exception\DbException
  63. */
  64. public function state()
  65. {
  66. $this->_save(ShopGoodsMark::mk());
  67. }
  68. /**
  69. * 删除商品标签
  70. * @auth true
  71. * @throws \think\db\exception\DbException
  72. */
  73. public function remove()
  74. {
  75. $this->_delete(ShopGoodsMark::mk());
  76. }
  77. }