Group.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\user\controller;
  3. use app\common\model\UserLevel;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 会员分组管理
  8. * Class UserGroup
  9. * @package app\user\controller
  10. */
  11. class Group extends Controller
  12. {
  13. /**
  14. * 绑定数据表
  15. * @var string
  16. */
  17. protected $table = 'UserGroup';
  18. /**
  19. * 分组管理
  20. * @auth true
  21. * @menu true
  22. * @throws \think\Exception
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\ModelNotFoundException
  25. * @throws \think\exception\DbException
  26. * @throws \think\exception\PDOException
  27. */
  28. public function index()
  29. {
  30. $this->title = '分组管理';
  31. $this->level_arr = UserLevel::column('name','id');
  32. $query = $this->_query($this->table)->order('id asc')->page();
  33. }
  34. /**
  35. * 数据列表处理
  36. * @auth true
  37. * @menu true
  38. * @param array $data
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\ModelNotFoundException
  41. * @throws \think\exception\DbException
  42. */
  43. protected function _index_page_filter(&$data)
  44. {
  45. }
  46. /**
  47. * 添加分组
  48. * @auth true
  49. * @menu true
  50. * @throws \think\Exception
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. * @throws \think\exception\DbException
  54. * @throws \think\exception\PDOException
  55. */
  56. public function add()
  57. {
  58. $this->title = '添加分组';
  59. $this->level_arr = UserLevel::column('name','id');
  60. $this->_form($this->table, 'form');
  61. }
  62. /**
  63. * 编辑分组
  64. * @auth true
  65. * @menu true
  66. * @throws \think\Exception
  67. * @throws \think\db\exception\DataNotFoundException
  68. * @throws \think\db\exception\ModelNotFoundException
  69. * @throws \think\exception\DbException
  70. * @throws \think\exception\PDOException
  71. */
  72. public function edit()
  73. {
  74. $this->title = '编辑分组';
  75. $this->level_arr = UserLevel::column('name','id');
  76. $this->_form($this->table, 'form');
  77. }
  78. /**
  79. * 删除
  80. * @auth true
  81. * @menu true
  82. * @throws \think\Exception
  83. * @throws \think\exception\PDOException
  84. */
  85. public function del()
  86. {
  87. $this->_save($this->table, ['is_deleted' => 1]);
  88. }
  89. /**
  90. * 表单数据处理
  91. * @auth true
  92. * @menu true
  93. * @param array $data
  94. */
  95. protected function _form_filter(&$data)
  96. {
  97. }
  98. /**
  99. * 删除
  100. * @auth true
  101. * @menu true
  102. * @throws \think\Exception
  103. * @throws \think\exception\PDOException
  104. */
  105. public function remove()
  106. {
  107. $this->_save($this->table, ['is_deleted' => 1]);
  108. }
  109. }