Template.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. namespace app\operate\controller;
  3. use library\Controller;
  4. use library\service\MenuService;
  5. use library\tools\Data;
  6. use think\Db;
  7. /**
  8. * 活动报名模板
  9. * Class Template
  10. * @package app\operate\controller
  11. */
  12. class Template extends Controller
  13. {
  14. /**
  15. * 绑定数据表
  16. * @var string
  17. */
  18. protected $table = 'ActivityTemplate';
  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)->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->_form($this->table, 'form');
  60. }
  61. /**
  62. * 编辑
  63. * @auth true
  64. * @menu true
  65. * @throws \think\Exception
  66. * @throws \think\db\exception\DataNotFoundException
  67. * @throws \think\db\exception\ModelNotFoundException
  68. * @throws \think\exception\DbException
  69. * @throws \think\exception\PDOException
  70. */
  71. public function edit()
  72. {
  73. $this->title = '编辑';
  74. $this->_form($this->table, 'form');
  75. }
  76. /**
  77. * 表单数据处理
  78. * @param array $vo
  79. * @throws \ReflectionException
  80. * @throws \think\db\exception\DataNotFoundException
  81. * @throws \think\db\exception\ModelNotFoundException
  82. * @throws \think\exception\DbException
  83. */
  84. protected function _form_filter(&$vo)
  85. {
  86. }
  87. /**
  88. * 启用
  89. * @auth true
  90. * @menu true
  91. * @throws \think\Exception
  92. * @throws \think\exception\PDOException
  93. */
  94. public function resume()
  95. {
  96. $this->_save($this->table, ['status' => '1']);
  97. }
  98. /**
  99. * 禁用
  100. * @auth true
  101. * @menu true
  102. * @throws \think\Exception
  103. * @throws \think\db\exception\DataNotFoundException
  104. * @throws \think\db\exception\ModelNotFoundException
  105. * @throws \think\exception\DbException
  106. * @throws \think\exception\PDOException
  107. */
  108. public function forbid()
  109. {
  110. $this->_save($this->table, ['status' => '0']);
  111. }
  112. /**
  113. * 删除
  114. * @auth true
  115. * @menu true
  116. * @throws \think\Exception
  117. * @throws \think\exception\PDOException
  118. */
  119. public function remove()
  120. {
  121. $this->_save($this->table, ['is_deleted' => 1]);
  122. }
  123. }