['except' => ['index','reg','login'] ] ]; /** * 文章投诉接口. */ public function complaint(){ $param = get_params(); $id = $param['id']; //文章id $content = $param['content']; //投诉内容 $type = $param['type']??1; //标识(1文章/2朋友圈) $user_id = $this->request->uid;//用户的id $where['article_id'] = $id; $where['user_id'] = $user_id; $where['type'] = $type; $is_complaint = Db::table('fa_article_complaint')->where($where)->find(); if($is_complaint){ $this->apiError('您已投诉!'); }else{ $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); $data = []; if ($useraddress) { $data['county'] = $useraddress['area_id']; $data['township'] = $useraddress['street_id']; $data['village'] = $useraddress['village_id']; } $data['article_id'] = $id; $data['user_id'] = $user_id; $data['type'] = $type; $data['content'] = $content; $data['createtime'] = time(); $res = Db::table('fa_article_complaint')->strict(false)->insert($data); if($res){ $this->apiSuccess('投诉成功'); }else{ $this->apiError('投诉失败'); } } } }