BanModel.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace app\nutrition\controller;
  3. use library\Controller;
  4. /**
  5. * 禁用机型
  6. * Class BanModel
  7. * @package app\mall\controller
  8. */
  9. class BanModel extends Controller
  10. {
  11. /**
  12. * 绑定数据表
  13. * @var string
  14. */
  15. protected $table = 'BanPhoneModel';
  16. /**
  17. * 列表
  18. * @auth true
  19. * @menu true
  20. * @throws \think\Exception
  21. * @throws \think\db\exception\DataNotFoundException
  22. * @throws \think\db\exception\ModelNotFoundException
  23. * @throws \think\exception\DbException
  24. * @throws \think\exception\PDOException
  25. */
  26. public function index()
  27. {
  28. $this->title = '列表';
  29. $query = $this->_query($this->table);
  30. $query->like('name')->where('is_deleted',0);
  31. $query->order('id desc')->page();
  32. }
  33. /**
  34. * 数据列表处理
  35. * @auth true
  36. * @menu true
  37. * @param array $data
  38. * @throws \think\db\exception\DataNotFoundException
  39. * @throws \think\db\exception\ModelNotFoundException
  40. * @throws \think\exception\DbException
  41. */
  42. protected function _index_page_filter(&$data)
  43. {
  44. }
  45. /**
  46. * 添加
  47. * @auth true
  48. * @menu true
  49. * @throws \think\Exception
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\ModelNotFoundException
  52. * @throws \think\exception\DbException
  53. * @throws \think\exception\PDOException
  54. */
  55. public function add()
  56. {
  57. $this->title = '添加';
  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->title = '编辑';
  73. $this->_form($this->table, 'form');
  74. }
  75. /**
  76. * 启用
  77. * @auth true
  78. * @menu true
  79. * @throws \think\Exception
  80. * @throws \think\exception\PDOException
  81. */
  82. public function enable()
  83. {
  84. $this->_save($this->table, ['status' => 1]);
  85. }
  86. /**
  87. * 删除
  88. * @auth true
  89. * @menu true
  90. * @throws \think\Exception
  91. * @throws \think\exception\PDOException
  92. */
  93. public function del()
  94. {
  95. $this->_save($this->table, ['is_deleted' => 1]);
  96. }
  97. }