123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- namespace app\api\controller;
- use app\common\model\ArticleComment;
- use app\common\model\ArticleIntro;
- use app\common\model\ArticleItem;
- use app\common\model\DatumComment;
- use app\common\model\DatumIntro;
- use app\common\model\DatumUrl;
- use app\common\model\ReportCase;
- use app\common\model\User;
- use app\common\model\UserForum;
- use app\common\model\UserReport;
- use app\common\model\VideoComment;
- use app\common\model\VideoIntro;
- use app\common\model\VideoUrl;
- use library\tools\Data;
- class Report extends Base
- {
- public function initialize()
- {
- parent::initialize();
- parent::checkLogin();
- }
-
- public function getReportCase()
- {
- $list = ReportCase::where(['is_deleted'=>0])->field('id,title,pid')->order('sort desc')->select()->toArray();
- $list = make_tree($list);
- $this->success('ok',['list'=>$list]);
- }
-
- public function userReport()
- {
- $type= input('post.type',1);
- $report_id = input('post.report_id');
- $case_ids = input('post.case_ids');
- $content = input('post.content');
- if(!$report_id) $this->error('请现在举报内容');
- if(!$case_ids) $this->error('请选择举报原因');
-
- switch ($type)
- {
- case 1:
- $check_id = VideoIntro::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('视频不存在');
- break;
- case 2:
- $check_id = VideoComment::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('视频评论不存在');
- break;
- case 3:
- $check_id = User::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('会员不存在');
- break;
- case 4:
- $check_id = DatumIntro::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('资料不存在');
- break;
- case 5:
- $check_id = ArticleIntro::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('图文不存在');
- break;
- case 6:
- $check_id = UserForum::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('问答问题不存在');
- break;
- case 7:
- $check_id = \app\common\model\Press::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('新闻不存在');
- break;
- case 8:
- $check_id = ArticleComment::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('评论不存在');
- break;
- case 9:
- $check_id = \app\common\model\PressComment::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('评论不存在');
- break;
- case 10:
- $check_id = DatumComment::where('id',$report_id)->value('id');
- if(!$check_id) $this->error('评论不存在');
- break;
- }
- UserReport::report($this->user_id,$type,$report_id,$case_ids,$content);
- $this->success('举报成功');
- }
- }
|