VideoReport.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\nutrition\controller;
  3. use app\common\model\VideoIntro;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 举报
  8. * Class VideoReport
  9. * @package app\nutrition\controller
  10. */
  11. class VideoReport extends Controller
  12. {
  13. protected $table ="UserReport";
  14. /**
  15. * 反馈变更列表
  16. * @auth true
  17. * @menu true
  18. */
  19. public function index()
  20. {
  21. $this->title = '举报列表';
  22. $where= [];
  23. if($this->request->request('name')) $where[]= ['m.name','like','%'.$this->request->request('name').'%'];
  24. if($this->request->request('content')) $where[]= ['f.content','like','%'.$this->request->request('content').'%'];
  25. $where[]= ['f.is_deleted','=',0];
  26. $where[]= ['f.type','=',1];
  27. $query = $this->_query($this->table);
  28. $query->alias('f')
  29. ->field('f.* ,m.headimg,m.name')
  30. ->join('store_member m',' m.id = f.user_id ','LEFT');
  31. if(!empty($where)) $query->where($where);
  32. $query ->order('f.id desc')->page();
  33. }
  34. /**反馈列表处理
  35. * @param array $data
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. * @throws \think\exception\DbException
  39. */
  40. protected function _index_page_filter(array &$data)
  41. {
  42. array_walk($data,function (&$val,$key){
  43. $val['report_arr'] = \app\common\model\ReportCase::where('id','in',$val['case_ids'])->column('title');
  44. $video_info = VideoIntro::where('id',$val['report_id'])->find();
  45. $val['object_type'] = $video_info ? $video_info->type:'';
  46. $val['video_title'] = $video_info ? $video_info->title:'';
  47. });
  48. }
  49. /**
  50. * 删除反馈日志
  51. * @auth true
  52. * @menu true
  53. */
  54. public function del()
  55. {
  56. $this->_save($this->table, ['is_deleted' => 1]);
  57. }
  58. /**
  59. * 回复
  60. * @auth true
  61. * @menu true
  62. */
  63. public function edit()
  64. {
  65. $this->title = '回复';
  66. $this->_form($this->table,'form');
  67. }
  68. protected function _form_filter(&$data)
  69. {
  70. if($this->request->action() == 'edit' && $this->request->isGet())
  71. {
  72. $data['title'] = \app\common\model\VideoIntro::where('id',$data['report_id'])->value('title');
  73. }
  74. }
  75. }