PressComment.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace app\operate\controller;
  3. use library\Controller;
  4. /**
  5. * 需求评论
  6. * Class PressComment
  7. * @package app\operate\controller
  8. */
  9. class PressComment extends Controller
  10. {
  11. /**
  12. * 绑定数据表
  13. * @var string
  14. */
  15. protected $table = 'PressComment';
  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. $this->first_id = input('first_id');
  30. $sel_where = [];
  31. $sel_where[] = ['c.is_deleted','=',0];
  32. $sel_where[] = ['c.first_id','=',$this->first_id];
  33. if($content = $this->request->get('content'))$sel_where[] = ['c.content','like','%'.$content.'%'];
  34. if($name = $this->request->get('name'))$sel_where[] = ['u.name','like','%'.$name.'%'];
  35. $query = $this->_query($this->table)->alias('c')
  36. ->field('c.*,u.name,u.headimg')
  37. ->leftJoin("store_member u",'u.id = c.user_id')
  38. ->where($sel_where)->order('is_top desc,id desc')->page();
  39. }
  40. /**
  41. * 数据列表处理
  42. * @auth true
  43. * @menu true
  44. * @param array $data
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. * @throws \think\exception\DbException
  48. */
  49. protected function _index_page_filter(&$data)
  50. {
  51. }
  52. // 回复
  53. public function reply()
  54. {
  55. $this->title = '回复';
  56. $this->_form($this->table, 'form');
  57. }
  58. /**
  59. * 删除
  60. * @auth true
  61. * @menu true
  62. * @throws \think\Exception
  63. * @throws \think\db\exception\DataNotFoundException
  64. * @throws \think\db\exception\ModelNotFoundException
  65. * @throws \think\exception\DbException
  66. * @throws \think\exception\PDOException
  67. */
  68. public function del()
  69. {
  70. $this->_save($this->table, ['is_deleted' => 1]);
  71. }
  72. /**
  73. * 表单数据处理
  74. * @auth true
  75. * @menu true
  76. * @param array $data
  77. */
  78. protected function _form_filter(&$data)
  79. {
  80. if($this->request->isGet()) {
  81. $this->source_id = $data['source_id'] ? $data['source_id'] : $data['id'];
  82. }
  83. }
  84. /**
  85. * 置顶设置
  86. * @auth true
  87. * @menu true
  88. * @param array $data
  89. */
  90. public function stick()
  91. {
  92. $this->_save($this->table, ['is_top' => input('is_top')]);
  93. }
  94. }