ApplyReport.php 2.6 KB

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