CommentReport.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 9:
  64. $val['object_info'] = \app\common\model\PressComment::where('id',$val['report_id'])->find()->toArray();
  65. $val['be_report'] = \app\common\model\Press::field('a.id second_id,a.title second_title')
  66. ->alias('a')
  67. ->where('a.id', $val['object_info']['first_id'])
  68. ->find()->toArray();
  69. break;
  70. case 10:
  71. $val['object_info'] = \app\common\model\DatumComment::where('id',$val['report_id'])->find()->toArray();
  72. $val['be_report'] = \app\common\model\DatumUrl::field('a.id second_id,a.title second_title, b.id first_id,b.title first_title')
  73. ->alias('a')
  74. ->where('a.id', $val['object_info']['url_id'])
  75. ->leftJoin('DatumIntro b','b.id = a.datum_id')
  76. ->find()->toArray();
  77. break;
  78. case 12:
  79. $val['object_info'] = ForumReplyComment::where('id',$val['report_id'])->find()->toArray();
  80. $val['be_report'] = UserForum::field('a.id second_id,a.title second_title')->alias('a')->where('a.id', $val['object_info']['forum_id'])
  81. ->find()->toArray();
  82. break;
  83. case 14:
  84. $val['object_info'] = \app\common\model\SupplierComment::where('id',$val['report_id'])->find()->toArray();
  85. $val['be_report'] = \app\common\model\SupplierGoods::field('a.id second_id,a.name second_title')
  86. ->alias('a')
  87. ->where('a.id', $val['object_info']['goods_id'])
  88. ->find()->toArray();
  89. break;
  90. case 16:
  91. $val['object_info'] = \app\common\model\DemandComment::where('id',$val['report_id'])->find()->toArray();
  92. $val['be_report'] = \app\common\model\PlatformDemand::field('a.id second_id,a.title second_title')
  93. ->alias('a')
  94. ->where('a.id', $val['object_info']['demand_id'])
  95. ->find()->toArray();
  96. break;
  97. case 17:
  98. $val['object_info'] = \app\common\model\DemandComment::where('id',$val['report_id'])->find()->toArray();
  99. $val['be_report'] = \app\common\model\PlatformDemand::field('a.id second_id,a.title second_title')
  100. ->alias('a')
  101. ->where('a.id', $val['object_info']['first_id'])
  102. ->find()->toArray();
  103. break;
  104. }
  105. });
  106. }
  107. /**
  108. * 删除
  109. * @auth true
  110. * @menu true
  111. */
  112. public function del()
  113. {
  114. $this->_save($this->table, ['is_deleted' => 1]);
  115. }
  116. /**
  117. * 批量删除
  118. * @auth true
  119. * @menu true
  120. */
  121. public function remove()
  122. {
  123. $this->_save($this->table, ['is_deleted' => 1]);
  124. }
  125. /**
  126. * 回复
  127. * @auth true
  128. * @menu true
  129. */
  130. public function edit()
  131. {
  132. $this->title = '回复';
  133. $this->_form($this->table,'form');
  134. }
  135. protected function _form_filter(&$data)
  136. {
  137. if($this->request->action() == 'edit' && $this->request->isGet())
  138. {
  139. $data['title'] = \app\common\model\ArticleIntro::where('id',$data['report_id'])->value('title');
  140. }
  141. }
  142. }