Message.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\user\controller;
  3. use app\common\model\LabelMessage;
  4. use app\common\service\UserSynth;
  5. use library\Controller;
  6. use think\Db;
  7. /**
  8. * 消息推送管理
  9. * Class Message
  10. * @package app\user\controller
  11. */
  12. class Message extends Controller
  13. {
  14. /**
  15. * 绑定数据表
  16. * @var string
  17. */
  18. protected $table = 'LabelMessage';
  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('type','in','2,3')->where('is_deleted',0)->order('id desc')->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. * @auth true
  79. * @menu true
  80. * @throws \think\Exception
  81. * @throws \think\exception\PDOException
  82. */
  83. public function del()
  84. {
  85. $this->_save($this->table, ['is_deleted' => 1]);
  86. }
  87. public function send()
  88. {
  89. $this->_form($this->table, 'send');
  90. }
  91. /**
  92. * 表单数据处理
  93. * @auth true
  94. * @menu true
  95. * @param array $data
  96. */
  97. protected function _form_filter(&$data)
  98. {
  99. $this->module_arr= [
  100. 'video'=> '视频',
  101. 'article'=> '图文',
  102. 'datum'=> '资料',
  103. 'supplier'=> '供应商产品',
  104. 'activity'=> '活动',
  105. 'forum'=> '问答',
  106. 'press'=> '新闻',
  107. 'recruit'=> '招聘',
  108. ];
  109. $this->module_list= UserSynth::getAllModuleTitle();
  110. }
  111. }