VideoComment.php 2.8 KB

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