handle($id); return $this->jsonSuccess(['pager' => $pager]); } /** * @Get("/{id:[0-9]+}/resources", name="api.chapter.resourses") */ public function resourcesAction($id) { $service = new ChapterResourceListService(); $resources = $service->handle($id); return $this->jsonSuccess(['resources' => $resources]); } /** * @Get("/{id:[0-9]+}/info", name="api.chapter.info") */ public function infoAction($id) { $service = new ChapterInfoService(); $chapter = $service->handle($id); if ($chapter['me']['owned'] == 0) { return $this->jsonError(['msg' => '没有访问章节权限']); } return $this->jsonSuccess(['chapter' => $chapter]); } /** * @Post("/{id:[0-9]+}/like", name="api.chapter.like") */ public function likeAction($id) { $service = new ChapterLikeService(); $service->handle($id); return $this->jsonSuccess(); } /** * @Post("/{id:[0-9]+}/learning", name="api.chapter.learning") */ public function learningAction($id) { $service = new ChapterLearningService(); $service->handle($id); return $this->jsonSuccess(); } }