DatumReport.php 2.3 KB

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