CommentReport.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. namespace app\nutrition\controller;
  3. use app\common\model\ForumReplyComment;
  4. use app\common\model\UserForum;
  5. use library\Controller;
  6. /**
  7. * 举报
  8. * Class CommentReport
  9. * @package app\nutrition\controller
  10. */
  11. class CommentReport 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. $type=input('type',8);
  23. $where= [];
  24. if($this->request->request('name')) $where[]= ['m.name','like','%'.$this->request->request('name').'%'];
  25. if($this->request->request('content')) $where[]= ['f.content','like','%'.$this->request->request('content').'%'];
  26. $where[]= ['f.is_deleted','=',0];
  27. $where[]= ['f.type','=',$type];
  28. $query = $this->_query($this->table);
  29. $query->alias('f')
  30. ->field('f.* ,m.headimg,m.name')
  31. ->join('store_member m',' m.id = f.user_id ','LEFT');
  32. if(!empty($where)) $query->where($where);
  33. $query ->order('f.id desc')->page();
  34. }
  35. /**反馈列表处理
  36. * @param array $data
  37. * @throws \think\db\exception\DataNotFoundException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. * @throws \think\exception\DbException
  40. */
  41. protected function _index_page_filter(array &$data)
  42. {
  43. array_walk($data,function (&$val,$key){
  44. $val['report_arr'] = \app\common\model\ReportCase::where('id','in',$val['case_ids'])->column('title');
  45. switch ($val['type'])
  46. {
  47. case 2:
  48. $val['object_info'] = \app\common\model\VideoComment::where('id',$val['report_id'])->find()->toArray();
  49. $val['be_report'] = \app\common\model\VideoUrl::field('a.id second_id,a.title second_title, b.id first_id,b.title first_title')
  50. ->alias('a')
  51. ->where('a.id', $val['object_info']['url_id'])
  52. ->leftJoin('VideoIntro b','b.id = a.video_id')
  53. ->find()->toArray();
  54. break;
  55. case 8:
  56. $val['object_info'] = \app\common\model\ArticleComment::where('id',$val['report_id'])->find()->toArray();
  57. $val['be_report'] = \app\common\model\ArticleItem::field('a.id second_id,a.title second_title, b.id first_id,b.title first_title')
  58. ->alias('a')
  59. ->where('a.id', $val['object_info']['item_id'])
  60. ->leftJoin('ArticleIntro b','b.id = a.article_id')
  61. ->find()->toArray();
  62. break;
  63. case 10:
  64. $val['object_info'] = \app\common\model\DatumComment::where('id',$val['report_id'])->find()->toArray();
  65. $val['be_report'] = \app\common\model\DatumUrl::field('a.id second_id,a.title second_title, b.id first_id,b.title first_title')
  66. ->alias('a')
  67. ->where('a.id', $val['object_info']['url_id'])
  68. ->leftJoin('DatumIntro b','b.id = a.datum_id')
  69. ->find()->toArray();
  70. break;
  71. case 12:
  72. $val['object_info'] = ForumReplyComment::where('id',$val['report_id'])->find()->toArray();
  73. $val['be_report'] = UserForum::field('a.id second_id,a.title second_title')->alias('a')->where('a.id', $val['object_info']['forum_id'])
  74. ->find()->toArray();
  75. break;
  76. case 14:
  77. $val['object_info'] = \app\common\model\SupplierComment::where('id',$val['report_id'])->find()->toArray();
  78. $val['be_report'] = \app\common\model\SupplierGoods::field('a.id second_id,a.name second_title')
  79. ->alias('a')
  80. ->where('a.id', $val['object_info']['goods_id'])
  81. ->find()->toArray();
  82. break;
  83. case 16:
  84. $val['object_info'] = \app\common\model\DemandComment::where('id',$val['report_id'])->find()->toArray();
  85. $val['be_report'] = \app\common\model\PlatformDemand::field('a.id second_id,a.title second_title')
  86. ->alias('a')
  87. ->where('a.id', $val['object_info']['demand_id'])
  88. ->find()->toArray();
  89. break;
  90. }
  91. });
  92. }
  93. /**
  94. * 删除
  95. * @auth true
  96. * @menu true
  97. */
  98. public function del()
  99. {
  100. $this->_save($this->table, ['is_deleted' => 1]);
  101. }
  102. /**
  103. * 批量删除
  104. * @auth true
  105. * @menu true
  106. */
  107. public function remove()
  108. {
  109. $this->_save($this->table, ['is_deleted' => 1]);
  110. }
  111. /**
  112. * 回复
  113. * @auth true
  114. * @menu true
  115. */
  116. public function edit()
  117. {
  118. $this->title = '回复';
  119. $this->_form($this->table,'form');
  120. }
  121. protected function _form_filter(&$data)
  122. {
  123. if($this->request->action() == 'edit' && $this->request->isGet())
  124. {
  125. $data['title'] = \app\common\model\ArticleIntro::where('id',$data['report_id'])->value('title');
  126. }
  127. }
  128. }