0])->field('id,title,pid')->order('sort desc')->select()->toArray(); $list = make_tree($list); $this->success('ok',['list'=>$list]); } /** * @title 用户举报 * @desc 用户举报 * @author qc * @url /api/Report/userReport * @method POST * @header name:Authorization require:1 desc:Token * @param name:type type:int default:1 desc:举报类型(1视频2视频评论3会员,4资料,5图文6问题,7新闻8图文评论9新闻评论,10资料评论,11问题的回答,12问题||回答评论举报,13=>供应商产品,14供应商产品评论,15活动,16需求,17需求评论,18招聘,19商城商品) * @param name:report_id type:int default:-- desc:举报内容的id * @param name:case_ids type:string default:-- desc:举报类目id串(逗号隔开) * @param name:content type:string default:-- desc:举报内容 */ 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('请选择举报原因'); //if(in_array($type,[2]) && !$content) $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('举报成功'); } }