ArticleReport.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\nutrition\controller;
  3. use app\common\model\ArticleIntro;
  4. use app\common\model\VideoIntro;
  5. use library\Controller;
  6. use think\Db;
  7. /**
  8. * 举报
  9. * Class ArticleReport
  10. * @package app\nutrition\controller
  11. */
  12. class ArticleReport extends Controller
  13. {
  14. protected $table ="UserReport";
  15. /**
  16. * 反馈变更列表
  17. * @auth true
  18. * @menu true
  19. */
  20. public function index()
  21. {
  22. $this->title = '举报列表';
  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','=',5];
  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. $object_info = ArticleIntro::where('id',$val['report_id'])->find()->toArray();
  46. $val['object_type'] = $object_info['type'];
  47. $val['object_title'] = $object_info['title'];
  48. });
  49. }
  50. /**
  51. * 删除反馈日志
  52. * @auth true
  53. * @menu true
  54. */
  55. public function del()
  56. {
  57. $this->_save($this->table, ['is_deleted' => 1]);
  58. }
  59. /**
  60. * 回复
  61. * @auth true
  62. * @menu true
  63. */
  64. public function edit()
  65. {
  66. $this->title = '回复';
  67. $this->_form($this->table,'form');
  68. }
  69. protected function _form_filter(&$data)
  70. {
  71. if($this->request->action() == 'edit' && $this->request->isGet())
  72. {
  73. $data['title'] = \app\common\model\ArticleIntro::where('id',$data['report_id'])->value('title');
  74. }
  75. }
  76. }