123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace app\nutrition\controller;
- use app\common\model\ArticleIntro;
- use app\common\model\VideoIntro;
- use library\Controller;
- use think\Db;
- /**
- * 举报
- * Class ArticleReport
- * @package app\nutrition\controller
- */
- class ArticleReport extends Controller
- {
- protected $table ="UserReport";
- /**
- * 反馈变更列表
- * @auth true
- * @menu true
- */
- public function index()
- {
- $this->title = '举报列表';
- $where= [];
- if($this->request->request('name')) $where[]= ['m.name','like','%'.$this->request->request('name').'%'];
- if($this->request->request('content')) $where[]= ['f.content','like','%'.$this->request->request('content').'%'];
- $where[]= ['f.is_deleted','=',0];
- $where[]= ['f.type','=',5];
- $query = $this->_query($this->table);
- $query->alias('f')
- ->field('f.* ,m.headimg,m.name')
- ->join('store_member m',' m.id = f.user_id ','LEFT');
- if(!empty($where)) $query->where($where);
- $query ->order('f.id desc')->page();
- }
- /**反馈列表处理
- * @param array $data
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- protected function _index_page_filter(array &$data)
- {
- array_walk($data,function (&$val,$key){
- $val['report_arr'] = \app\common\model\ReportCase::where('id','in',$val['case_ids'])->column('title');
- $object_info = ArticleIntro::where('id',$val['report_id'])->find()->toArray();
- $val['object_type'] = $object_info['type'];
- $val['object_title'] = $object_info['title'];
- });
- }
- /**
- * 删除反馈日志
- * @auth true
- * @menu true
- */
- public function del()
- {
- $this->_save($this->table, ['is_deleted' => 1]);
- }
- /**
- * 回复
- * @auth true
- * @menu true
- */
- public function edit()
- {
- $this->title = '回复';
- $this->_form($this->table,'form');
- }
- protected function _form_filter(&$data)
- {
- if($this->request->action() == 'edit' && $this->request->isGet())
- {
- $data['title'] = \app\common\model\ArticleIntro::where('id',$data['report_id'])->value('title');
- }
- }
- }
|