欢迎光临
我们一直在努力

javaweb小说阅读网站源码

后台采用springboot+mybatis

用户可以在线阅读小说

/** * 文章章节 控制器 * author qq2803180149 */ @Controller @RequestMapping("chapter") public class ChapterController { private final IChapterService iChapterService; private final IfictionService iFictionService; private final IChapterContentService iChapterContentService; private final IFictionShelfService iFictionShelfService; public ChapterController(IChapterService iChapterService, IFictionService iFictionService, IChapterContentService iChapterContentService, IFictionShelfService iFictionShelfService) { this.iChapterService = iChapterService; this.iFictionService = iFictionService; this.iChapterContentService = iChapterContentService; this.iFictionShelfService = iFictionShelfService; } //返回一本小说 @RequestMapping(value = "info/{fiction_id}", method = RequestMethod.GET) public String chapter(HttpServletRequest request, @PathVariable("fiction_id") int fiction_id, Model model) { Fiction fiction = iFictionService.getById(fiction_id); //添加点击量 iFictionService.addView(fiction); //检查该本小说是否保存在书架 int i = iFictionShelfService.isShelf(request, fiction_id); switch (i){ case 0: model.addAttribute("presence",0); break; case 1: model.addAttribute("presence",1); break; } model.addAttribute("fiction",fiction); model.addAttribute("title",fiction.getFictionName()); return "chapter/info"; } //返回一本小说所有章节 @RequestMapping(value = "list/{fiction_id}", method = RequestMethod.GET) public String chapterList(@PathVariable("fiction_id") int fiction_id, Model model) { Fiction fiction = iFictionService.getById(fiction_id); List<Chapter> chapterList = iChapterService.queryByFictionIdList(fiction_id); model.addAttribute("fiction",fiction); model.addAttribute("list",chapterList); model.addAttribute("size",chapterList.size()); model.addAttribute("title",fiction.getFictionName()); return "chapter/list"; } //当前小说页 @RequestMapping(value = "read/{fiction_id}/{sort}", method = RequestMethod.GET) public String chapterInfo(HttpServletRequest request,Model model, @PathVariable("fiction_id") int fiction_id,@PathVariable("sort") int sort) { //更新用户阅读章节 HttpSession session = request.getSession(); if (null!=session.getAttribute("id")){ int id = iFictionShelfService.updateShelf(fiction_id, (Integer) session.getAttribute("id"), sort); if (id!=1){ System.out.println("更新用户章节失败"); } } Chapter chapter=iChapterService.netChapter(fiction_id,sort); //获取小说内容 ChapterContent chapterContent=iChapterContentService.getById(chapter.getContentId()); model.addAttribute("chapter",chapter); model.addAttribute("content",chapterContent); model.addAttribute("title",chapter.getChapterTitle()); return "chapter/read"; } //上下页 @RequestMapping(value = "netRead/{fiction_id}/{sort}/{status}",method = RequestMethod.GET) public String netChapter(@PathVariable("fiction_id") int fiction_id,@PathVariable("sort") int sort,@PathVariable("status") int status,Model model) { if (status==1){ if (sort!=1){ sort=sort-1; } }else { sort=sort+1; } Chapter chapter = iChapterService.netChapter(fiction_id,sort); //获取小说内容 ChapterContent chapterContent=iChapterContentService.getById(chapter.getContentId()); model.addAttribute("chapter",chapter); model.addAttribute("content",chapterContent); model.addAttribute("title",chapter.getChapterTitle()); return "chapter/read"; } }

javaweb小说阅读网站源码

javaweb小说阅读网站源码

javaweb小说阅读网站源码

javaweb小说阅读网站源码

javaweb小说阅读网站源码

javaweb小说阅读网站源码

  • 海报
海报图正在生成中...
赞(0) 打赏
声明:
1、本博客不从事任何主机及服务器租赁业务,不参与任何交易,也绝非中介。博客内容仅记录博主个人感兴趣的服务器测评结果及一些服务器相关的优惠活动,信息均摘自网络或来自服务商主动提供;所以对本博客提及的内容不作直接、间接、法定、约定的保证,博客内容也不具备任何参考价值及引导作用,访问者需自行甄别。
2、访问本博客请务必遵守有关互联网的相关法律、规定与规则;不能利用本博客所提及的内容从事任何违法、违规操作;否则造成的一切后果由访问者自行承担。
3、未成年人及不能独立承担法律责任的个人及群体请勿访问本博客。
4、一旦您访问本博客,即表示您已经知晓并接受了以上声明通告。
文章名称:《javaweb小说阅读网站源码》
文章链接:https://www.456zj.com/28101.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址