[ 'uid' => 'required|numeric|max:15', ], 'unFollow' => [ 'uid' => 'required|numeric|max:15', ], ]; /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface * @throws ModelException */ function addFollow() { $oAuthService = new AuthService(); $aUser = $oAuthService->getCurrentUser(); $follow_uid = request()->input('uid'); if($aUser['id'] == $follow_uid) return $this->error('不能关注自己'); $oFollowModel = new FollowModel(); $aFollow = $oFollowModel->isFollow($aUser['id'], $follow_uid); if($aFollow) return $this->error('已关注'); $oFollowModel->addFollow($aUser['id'], $follow_uid); return $this->success(); } function unFollow() { $oAuthService = new AuthService(); $aUser = $oAuthService->getCurrentUser(); $follow_uid = request()->input('uid'); $oFollowModel = new FollowModel(); $oFollowModel->unFollow($aUser['id'], $follow_uid); return $this->success(); } }