UserReport.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace app\user\controller;
  3. use app\common\model\User;
  4. use app\common\model\VideoComment;
  5. use app\common\model\VideoIntro;
  6. use library\Controller;
  7. use think\Db;
  8. /**
  9. * 会员反馈
  10. * Class Integral
  11. * @package app\user\controller
  12. */
  13. class UserReport 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('phone').'%'];
  26. $where[]= ['f.is_deleted','=',0];
  27. $query = $this->_query($this->table);
  28. $query->alias('f')
  29. ->field('f.* ,m.headimg,m.name')
  30. ->join('store_member m',' m.id = f.user_id ','LEFT');
  31. if(!empty($where)) $query->where($where);
  32. $query ->order('f.id desc')->page();
  33. }
  34. /**反馈列表处理
  35. * @param array $data
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. * @throws \think\exception\DbException
  39. */
  40. protected function _index_page_filter(array &$data)
  41. {
  42. array_walk($data,function (&$val,$key){
  43. $val['report_arr'] = \app\common\model\ReportCase::where('id','in',$val['case_ids'])->column('title');
  44. switch ($val['type'])
  45. {
  46. case 1:
  47. $val['object'] = VideoIntro::where('id',$val['report_id'])->field('id,cover,video_url,title')->find()->toArray();
  48. break;
  49. case 2:
  50. $val['object'] = VideoComment::where('id',$val['report_id'])->field('id,content,create_at')->find()->toArray();
  51. break;
  52. case 3:
  53. $val['object'] = User::where('id',$val['report_id'])->field('id,headimg,name')->find()->toArray();
  54. break;
  55. }
  56. });
  57. }
  58. /**
  59. * 删除反馈日志
  60. * @auth true
  61. * @menu true
  62. */
  63. public function del()
  64. {
  65. $this->_save($this->table, ['is_deleted' => 1]);
  66. }
  67. /**
  68. * 回复
  69. * @auth true
  70. * @menu true
  71. */
  72. public function edit()
  73. {
  74. $this->title = '回复';
  75. $this->_form($this->table,'form');
  76. }
  77. }