├── README.md ├── blog.sql ├── images ├── 前台.png ├── 后台1.png ├── 后台2.png ├── 后台3.png └── 表结构.png ├── pom.xml └── src └── main ├── java └── com │ └── frozen │ └── myblog │ ├── Interceptor │ ├── AdminInterceptor.java │ └── AutoLoginInterceptor.java │ ├── controller │ ├── AdminController.java │ ├── ArticleController.java │ ├── BlogController.java │ ├── CarouselController.java │ ├── CategoryController.java │ ├── CommentController.java │ ├── LinkController.java │ ├── MailController.java │ ├── UserController.java │ └── VerifyCodeController.java │ ├── mapper │ ├── ArticleMapper.java │ ├── ArticleMapper.xml │ ├── CarouselMapper.java │ ├── CarouselMapper.xml │ ├── CategoryMapper.java │ ├── CategoryMapper.xml │ ├── CommentMapper.java │ ├── CommentMapper.xml │ ├── LinkMapper.java │ ├── LinkMapper.xml │ ├── UserMapper.java │ └── UserMapper.xml │ ├── pojo │ ├── Article.java │ ├── Carousel.java │ ├── Category.java │ ├── Comment.java │ ├── Link.java │ ├── MailPojo.java │ └── User.java │ ├── service │ ├── ArticleService.java │ ├── CarouselService.java │ ├── CategoryService.java │ ├── CommentService.java │ ├── LinkService.java │ ├── MailService.java │ ├── UserService.java │ └── implement │ │ ├── ArticleServiceImpl.java │ │ ├── CarouselServiceImpl.java │ │ ├── CategoryServiceImpl.java │ │ ├── CommentServiceImpl.java │ │ ├── LinkServiceImpl.java │ │ ├── MailServiceImpl.java │ │ └── UserServiceImpl.java │ └── util │ ├── Base64Utils.java │ ├── BlogException.java │ ├── ImgFontByte.java │ ├── MyUtils.java │ ├── Page.java │ ├── Uploader.java │ └── VerifyCode.java ├── resources ├── db.properties ├── log4j.properties ├── mail.properties ├── mybatis │ └── sqlMapConfig.xml └── spring │ ├── applicationContext-dao.xml │ ├── applicationContext-redis.xml │ ├── applicationContext-service.xml │ ├── applicationContext-trans.xml │ └── springmvc.xml └── webapp ├── WEB-INF ├── jsp │ ├── admin │ │ ├── articlelist.jsp │ │ ├── carousel.jsp │ │ ├── category.jsp │ │ ├── comment.jsp │ │ ├── error.jsp │ │ ├── head.jsp │ │ ├── index.jsp │ │ ├── link.jsp │ │ ├── success.jsp │ │ └── write.jsp │ ├── article.jsp │ ├── error.jsp │ ├── footer.jsp │ ├── head.jsp │ ├── index.jsp │ ├── login.jsp │ ├── personalcomment.jsp │ ├── register.jsp │ ├── sidebar.jsp │ └── success.jsp └── web.xml └── static ├── css ├── main.css └── register&login.css ├── img ├── admin.jpg ├── articlephoto │ ├── 0.jpg │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ └── 4.jpg ├── comment.png ├── emptyarticle.jpg ├── emptycomment.jpg ├── error.png ├── loginbackground.jpg ├── profilephoto │ ├── 0.jpg │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ └── 4.jpg ├── registerbackground.jpg └── success.jpg ├── js ├── jquery.min.js └── register&login.js ├── layui ├── css │ ├── layui.css │ ├── layui.mobile.css │ └── modules │ │ ├── code.css │ │ ├── laydate │ │ └── default │ │ │ └── laydate.css │ │ └── layer │ │ └── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── layer.css │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif ├── font │ ├── iconfont.eot │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff ├── images │ └── face │ │ ├── 0.gif │ │ ├── 1.gif │ │ ├── 10.gif │ │ ├── 11.gif │ │ ├── 12.gif │ │ ├── 13.gif │ │ ├── 14.gif │ │ ├── 15.gif │ │ ├── 16.gif │ │ ├── 17.gif │ │ ├── 18.gif │ │ ├── 19.gif │ │ ├── 2.gif │ │ ├── 20.gif │ │ ├── 21.gif │ │ ├── 22.gif │ │ ├── 23.gif │ │ ├── 24.gif │ │ ├── 25.gif │ │ ├── 26.gif │ │ ├── 27.gif │ │ ├── 28.gif │ │ ├── 29.gif │ │ ├── 3.gif │ │ ├── 30.gif │ │ ├── 31.gif │ │ ├── 32.gif │ │ ├── 33.gif │ │ ├── 34.gif │ │ ├── 35.gif │ │ ├── 36.gif │ │ ├── 37.gif │ │ ├── 38.gif │ │ ├── 39.gif │ │ ├── 4.gif │ │ ├── 40.gif │ │ ├── 41.gif │ │ ├── 42.gif │ │ ├── 43.gif │ │ ├── 44.gif │ │ ├── 45.gif │ │ ├── 46.gif │ │ ├── 47.gif │ │ ├── 48.gif │ │ ├── 49.gif │ │ ├── 5.gif │ │ ├── 50.gif │ │ ├── 51.gif │ │ ├── 52.gif │ │ ├── 53.gif │ │ ├── 54.gif │ │ ├── 55.gif │ │ ├── 56.gif │ │ ├── 57.gif │ │ ├── 58.gif │ │ ├── 59.gif │ │ ├── 6.gif │ │ ├── 60.gif │ │ ├── 61.gif │ │ ├── 62.gif │ │ ├── 63.gif │ │ ├── 64.gif │ │ ├── 65.gif │ │ ├── 66.gif │ │ ├── 67.gif │ │ ├── 68.gif │ │ ├── 69.gif │ │ ├── 7.gif │ │ ├── 70.gif │ │ ├── 71.gif │ │ ├── 8.gif │ │ └── 9.gif ├── lay │ └── modules │ │ ├── carousel.js │ │ ├── code.js │ │ ├── colorpicker.js │ │ ├── element.js │ │ ├── flow.js │ │ ├── form.js │ │ ├── jquery.js │ │ ├── laydate.js │ │ ├── layedit.js │ │ ├── layer.js │ │ ├── laypage.js │ │ ├── laytpl.js │ │ ├── mobile.js │ │ ├── rate.js │ │ ├── slider.js │ │ ├── table.js │ │ ├── tree.js │ │ ├── upload.js │ │ └── util.js ├── layui.all.js └── layui.js ├── validator ├── dist │ ├── css │ │ ├── bootstrapValidator.css │ │ └── bootstrapValidator.min.css │ └── js │ │ ├── bootstrapValidator.js │ │ ├── bootstrapValidator.min.js │ │ └── language │ │ ├── ar_MA.js │ │ ├── be_FR.js │ │ ├── be_NL.js │ │ ├── bg_BG.js │ │ ├── cs_CZ.js │ │ ├── da_DK.js │ │ ├── de_DE.js │ │ ├── en_US.js │ │ ├── es_CL.js │ │ ├── es_ES.js │ │ ├── fa_IR.js │ │ ├── fr_FR.js │ │ ├── gr_EL.js │ │ ├── he_IL.js │ │ ├── hu_HU.js │ │ ├── id_ID.js │ │ ├── it_IT.js │ │ ├── ja_JP.js │ │ ├── nl_NL.js │ │ ├── no_NO.js │ │ ├── pl_PL.js │ │ ├── pt_BR.js │ │ ├── pt_PT.js │ │ ├── ro_RO.js │ │ ├── ru_RU.js │ │ ├── sq_AL.js │ │ ├── sr_RS.js │ │ ├── sv_SE.js │ │ ├── th_TH.js │ │ ├── tr_TR.js │ │ ├── ua_UA.js │ │ ├── vi_VN.js │ │ ├── zh_CN.js │ │ └── zh_TW.js └── vendor │ ├── bootstrap │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ └── jasmine │ ├── boot.js │ ├── console.js │ ├── jasmine-html.js │ ├── jasmine.css │ ├── jasmine.js │ └── jasmine_favicon.png └── wangEditor ├── fonts └── w-e-icon.woff ├── wangEditor.css ├── wangEditor.js ├── wangEditor.min.css ├── wangEditor.min.js └── wangEditor.min.js.map /README.md: -------------------------------------------------------------------------------- 1 | # Blog 2 | ## 本项目是基于SSM框架的简单易上手的个人博客系统,适合ssm初学者练手使用。 3 | 预览地址:前台地址 :http://134.175.88.157 后台地址:http://134.175.88.157/admin 管理员默认测试账号:admin 密码:admin123,有兴趣的童鞋可以去测试玩玩。 4 | blog.sql是导出的数据库结构,可自行导入。 5 | 导入项目时修改db.properties和 6 | ## 使用到的技术及项目环境: 7 | tomcat7,maven3.5,java8,mysql,redis,SSM框架, 富文本编辑器wangEditor,前端框架:前台bootstrap,后台layui(使用两个前端框架的目的就是练手),ajax,实现restful风格等。 8 | 9 | ## 实现的功能有: 10 | 前台的评论增删、文章题目搜索、注册、登录、cookie自动登录、联系博主(使用博主的小号邮箱给博主邮箱发邮件),最新的三条评论展示。 11 | 后台的分类管理、文章管理、友链管理、轮播图管理、评论管理。 12 | 13 | ## 数据库是很简单的6张表: 14 | 文章表、轮播图表、分类表、评论表、友链表和用户表。 15 | ![表结构](https://github.com/frozen-lin/Blog/blob/master/images/%E8%A1%A8%E7%BB%93%E6%9E%84.png); 16 | ## redis作为缓存的存储策略: 17 | hash:"categoryHash"(存储全部分类)、 "articleHash"(存储全部文章)、 "linkHash"(存储全部友链)、"commentHash"(存储全部评论)、"carouselHash"(存储全部轮播图)。 18 | 19 | list:"article"+articleId(存储该文章下的评论。本想将评论存至所属的article的List中,但是发现同时提交多次评论会出现线程安全问题,导致评论被覆盖的现象。) 20 | 21 | value:"username:"+username(存储最近登录的用户,10天过期,过期后需要再从数据库中查找登录)、"mailNum"(存储的是前台发的邮件次数,后台点击邮件可清零。) 22 | 23 | ## 修改tomcat使用的编码格式: 24 | 25 | 默认情况下,tomcat使用的的编码方式:iso8859-1。 26 | 27 | 在tomcat下的conf/server.xml文件: 28 | 29 | 找到如下代码: 30 | 31 | 这段代码规定了Tomcat监听HTTP请求的端口号等信息。 32 | 33 | 可以在这里添加一个属性:URIEncoding="UTF-8",即可让tomcat以UTF-8的编码处理get请求。 34 | 35 | 修改后: 36 | 37 | 38 | 不添加的话该项目的get请求会出现乱码。 39 | ## 前台预览图片: 40 | ![前台](https://github.com/frozen-lin/Blog/blob/master/images/%E5%89%8D%E5%8F%B0.png) 41 | ## 后台预览图片: 42 | ![后台1](https://github.com/frozen-lin/Blog/blob/master/images/%E5%90%8E%E5%8F%B01.png) 43 | ![后台2](https://github.com/frozen-lin/Blog/blob/master/images/%E5%90%8E%E5%8F%B02.png) 44 | ![后台3](https://github.com/frozen-lin/Blog/blob/master/images/%E5%90%8E%E5%8F%B03.png) 45 | 46 | ## 如果觉得还可以的同学,帮忙点一下star和fork。 47 | 48 | -------------------------------------------------------------------------------- /images/前台.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/images/前台.png -------------------------------------------------------------------------------- /images/后台1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/images/后台1.png -------------------------------------------------------------------------------- /images/后台2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/images/后台2.png -------------------------------------------------------------------------------- /images/后台3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/images/后台3.png -------------------------------------------------------------------------------- /images/表结构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/images/表结构.png -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/Interceptor/AdminInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.Interceptor; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.springframework.web.servlet.HandlerInterceptor; 7 | import org.springframework.web.servlet.ModelAndView; 8 | 9 | import com.frozen.myblog.pojo.User; 10 | 11 | public class AdminInterceptor implements HandlerInterceptor { 12 | 13 | @Override 14 | public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3) 15 | throws Exception { 16 | 17 | } 18 | 19 | @Override 20 | public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3) 21 | throws Exception { 22 | 23 | } 24 | //进入controller调用,拦截权限不足的用户进入后台 25 | @Override 26 | public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object o) throws Exception { 27 | User user=(User)req.getSession().getAttribute("user"); 28 | //若已登录且用户权限=1放行,否则拦截 29 | if(user!=null&&user.getPermission().equals(1)) { 30 | return true; 31 | } 32 | req.setAttribute("msg", "您无权进入后台!!"); 33 | req.getRequestDispatcher("/login").forward(req, resp); 34 | return false; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/Interceptor/AutoLoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.Interceptor; 2 | 3 | import java.net.URLDecoder; 4 | 5 | import javax.servlet.http.Cookie; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.servlet.HandlerInterceptor; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import com.frozen.myblog.pojo.User; 14 | import com.frozen.myblog.service.UserService; 15 | import com.frozen.myblog.util.MyUtils; 16 | 17 | public class AutoLoginInterceptor implements HandlerInterceptor { 18 | @Autowired 19 | private UserService us; 20 | 21 | @Override 22 | public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3) 23 | throws Exception { 24 | 25 | } 26 | 27 | @Override 28 | public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3) 29 | throws Exception { 30 | 31 | } 32 | 33 | @Override 34 | public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object o) throws Exception { 35 | // 检查是否已登录 36 | User user = (User) req.getSession().getAttribute("user"); 37 | if (user == null) { 38 | Cookie[] cookies = req.getCookies(); 39 | String username = null; 40 | String password = null; 41 | // 取出cookie中的用户名、密码 42 | if (cookies != null) { 43 | for (Cookie cookie : cookies) { 44 | if ("username".equals(cookie.getName())) { 45 | //因为存入时编码了,所以取出要进行解码 46 | username = URLDecoder.decode(cookie.getValue(),"UTF-8"); 47 | } 48 | if ("password".equals(cookie.getName())) { 49 | password = cookie.getValue(); 50 | } 51 | } 52 | } 53 | // 若取出的用户名密码都不为空 54 | if (!MyUtils.checkempty(username) && !MyUtils.checkempty(password)) { 55 | user = new User(); 56 | user.setUsername(username); 57 | user.setPassword(password); 58 | //登录 59 | User t_user=us.login(user); 60 | req.getSession().setAttribute("user", t_user); 61 | } 62 | } 63 | return true; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.Model; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | 13 | import com.frozen.myblog.pojo.Article; 14 | import com.frozen.myblog.pojo.Carousel; 15 | import com.frozen.myblog.pojo.Category; 16 | import com.frozen.myblog.service.ArticleService; 17 | import com.frozen.myblog.service.CarouselService; 18 | import com.frozen.myblog.service.CategoryService; 19 | import com.frozen.myblog.service.CommentService; 20 | import com.frozen.myblog.service.LinkService; 21 | import com.frozen.myblog.service.UserService; 22 | 23 | @Controller 24 | @RequestMapping("/admin") 25 | public class AdminController { 26 | @Autowired 27 | private CategoryService cs; 28 | @Autowired 29 | private ArticleService as; 30 | @Autowired 31 | private UserService us; 32 | @Autowired 33 | private LinkService ls; 34 | @Autowired 35 | private CommentService commentService; 36 | @Autowired 37 | private CarouselService carouselService; 38 | 39 | //转发后台首页 40 | @RequestMapping(value= {"","/index"}, method = RequestMethod.GET) 41 | public String toAdminIndex(Model model) { 42 | Integer articleCount = as.queryArticleCount(); 43 | Integer userCount = us.queryUserCount(); 44 | Integer linkCount = ls.queryLinkCount(); 45 | Integer commentCount = commentService.queryCommentCount(); 46 | model.addAttribute("articleCount", articleCount); 47 | model.addAttribute("userCount", userCount); 48 | model.addAttribute("linkCount", linkCount); 49 | model.addAttribute("commentCount", commentCount); 50 | return "admin/index.jsp"; 51 | } 52 | 53 | //转发后台写文章页面 54 | @RequestMapping(value = "/write", method = RequestMethod.GET) 55 | public String toWrite() { 56 | return "admin/write.jsp"; 57 | } 58 | 59 | //转发后台成功页面 60 | @RequestMapping(value = "/success", method = RequestMethod.GET) 61 | public String toSuccess(Model model) { 62 | return "admin/success.jsp"; 63 | } 64 | 65 | //转发后台错误页面 66 | @RequestMapping(value = "/error", method = RequestMethod.GET) 67 | public String toError(Model model) { 68 | return "admin/error.jsp"; 69 | } 70 | 71 | //转发分类管理页面 72 | @RequestMapping(value = "/category", method = RequestMethod.GET) 73 | public String toCategory(Model model) { 74 | List categorylist = cs.queryCategoryAndArticleCount(); 75 | Collections.sort(categorylist); 76 | model.addAttribute("list", categorylist); 77 | return "admin/category.jsp"; 78 | } 79 | 80 | //转发修改文章页面 81 | @RequestMapping(value = "/edit/{articleId}", method = RequestMethod.GET) 82 | public String toEditArticle(@PathVariable Integer articleId, Model model) { 83 | Article article = as.queryArticleById(articleId); 84 | if(article==null) {return "forward:/admin/error";} 85 | model.addAttribute("article", article); 86 | return "admin/write.jsp"; 87 | } 88 | 89 | //转发友链管理页面 90 | @RequestMapping(value = "/link", method = RequestMethod.GET) 91 | public String toLink() { 92 | return "admin/link.jsp"; 93 | } 94 | 95 | //转发轮播图管理页面 96 | @RequestMapping(value = "/carousel", method = RequestMethod.GET) 97 | public String toCarousel(Model model) { 98 | List list = carouselService.queryCarousel(); 99 | Collections.sort(list); 100 | model.addAttribute("list", list); 101 | return "admin/carousel.jsp"; 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/BlogController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | import com.frozen.myblog.pojo.Article; 11 | import com.frozen.myblog.service.ArticleService; 12 | import com.frozen.myblog.util.MyUtils; 13 | import com.frozen.myblog.util.Page; 14 | 15 | @Controller 16 | public class BlogController { 17 | @Autowired 18 | ArticleService as; 19 | 20 | // 前台的成功页面 21 | @RequestMapping(value = "/success", method = RequestMethod.GET) 22 | public String toSuccess(Model model) { 23 | return "success.jsp"; 24 | } 25 | 26 | // 前台的错误页面 27 | @RequestMapping(value = "/error", method = RequestMethod.GET) 28 | public String toError(Model model) { 29 | model.addAttribute("msg", "error"); 30 | return "error.jsp"; 31 | } 32 | 33 | // 前台首页 ,跳转分类为全部的第一页 34 | @RequestMapping(value= {"","/index"},method = RequestMethod.GET) 35 | public String toIndex() { 36 | return "forward:/category/0"; 37 | } 38 | 39 | // 前台搜 40 | @RequestMapping(value = "/search", method = RequestMethod.GET) 41 | public String search() { 42 | return "forward:/search/p/1"; 43 | } 44 | 45 | // 前台搜索 46 | @RequestMapping(value = "/search/p/{curr}", method = RequestMethod.GET) 47 | public String search(@PathVariable(required=true)Integer curr,String q,Model model) { 48 | if(curr<1) return "forward:/error"; 49 | //ruo查询条件为空,相当于查全部,转发至首页 50 | if(MyUtils.checkempty(q)) { 51 | return "forward:/index"; 52 | } 53 | Page
articlePage = as.queryArticlePageByParameter(q,curr); 54 | model.addAttribute("articlePage", articlePage); 55 | return "index.jsp"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/CarouselController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.io.File; 4 | import java.util.Collections; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | import org.apache.commons.io.FileUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.ResponseBody; 18 | import org.springframework.web.multipart.MultipartFile; 19 | 20 | import com.frozen.myblog.pojo.Carousel; 21 | import com.frozen.myblog.service.CarouselService; 22 | import com.frozen.myblog.util.BlogException; 23 | import com.frozen.myblog.util.Uploader; 24 | 25 | @Controller 26 | public class CarouselController { 27 | @Autowired 28 | CarouselService cs; 29 | 30 | // 上传轮播图图片 31 | @RequestMapping(value = "/admin/carousel", method = RequestMethod.POST) 32 | @ResponseBody 33 | public Map CarouselUp(MultipartFile file, HttpServletRequest req) { 34 | Map map = new HashMap(); 35 | try { 36 | Uploader up = new Uploader(req); 37 | // 设置上传参数 38 | up.setFile(file); 39 | up.setSavePath("static/upload/carousel"); 40 | // 上传 41 | up.upload(); 42 | if (up.getState() != "success") { 43 | throw new BlogException("上传失败"); 44 | } 45 | Carousel carousel = new Carousel(); 46 | carousel.setCarouselUrl(up.getUrl()); 47 | cs.saveCarousel(carousel); 48 | map.put("errno", "0"); 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | map.put("errno", "1"); 52 | } 53 | return map; 54 | } 55 | 56 | // ajax提交修改 轮播图信息表单 57 | @RequestMapping(value = "/admin/carousel", method = RequestMethod.PUT) 58 | @ResponseBody 59 | public Map editCarousel(Carousel carousel) { 60 | Map map = new HashMap(); 61 | try { 62 | if (carousel.getCarouselId() == null) { 63 | throw new BlogException("没有轮播图Id"); 64 | } 65 | cs.editCarousel(carousel); 66 | map.put("errno", "0"); 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | map.put("errno", "1"); 70 | map.put("msg", e.getMessage()); 71 | } 72 | return map; 73 | } 74 | 75 | // ajax请求 删除轮播图 76 | @RequestMapping(value = "/admin/carousel/{carouselId}", method = RequestMethod.DELETE) 77 | @ResponseBody 78 | public Map deleteCarousel(@PathVariable(required = true) Integer carouselId, 79 | HttpServletRequest req) { 80 | Map map = new HashMap(); 81 | try { 82 | Carousel carousel = cs.deleteCarousel(carouselId); 83 | map.put("errno", "0"); 84 | try { 85 | if (carousel != null) { 86 | // 获取图片真实路径 87 | String path = carousel.getCarouselUrl().substring(carousel.getCarouselUrl().indexOf("/static")); 88 | String realpath = req.getSession().getServletContext().getRealPath(path); 89 | // commons-io删除图片 90 | FileUtils.forceDelete(new File(realpath)); 91 | } 92 | } catch (Exception e) { 93 | e.printStackTrace(); 94 | } 95 | } catch (Exception e) { 96 | e.printStackTrace(); 97 | map.put("errno", "1"); 98 | map.put("msg", e.getMessage()); 99 | } 100 | return map; 101 | } 102 | //ajax请求order排前三的轮播图 103 | @RequestMapping(value = "/carousel", method = RequestMethod.GET) 104 | @ResponseBody 105 | public List getCarousel() { 106 | List list = cs.queryCarousel(); 107 | Collections.sort(list); 108 | //取前三条 109 | return list.subList(0, 3); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/CategoryController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.ui.Model; 11 | import org.springframework.web.bind.annotation.PathVariable; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | 16 | import com.frozen.myblog.pojo.Article; 17 | import com.frozen.myblog.pojo.Category; 18 | import com.frozen.myblog.service.ArticleService; 19 | import com.frozen.myblog.service.CategoryService; 20 | import com.frozen.myblog.util.BlogException; 21 | import com.frozen.myblog.util.MyUtils; 22 | import com.frozen.myblog.util.Page; 23 | 24 | @Controller 25 | public class CategoryController { 26 | @Autowired 27 | private CategoryService cs; 28 | @Autowired 29 | private ArticleService as; 30 | 31 | // produces解决返回前台字符串中文乱码问题 ,ajax提交新 分类表单 32 | @RequestMapping(value = "/admin/category", method = RequestMethod.POST, produces = "application/text; charset=utf-8") 33 | @ResponseBody() 34 | public String addCategory(Category category) { 35 | if (MyUtils.checkempty(category.getCategoryName())) { 36 | return "文章分类不能为空。"; 37 | } 38 | try { 39 | cs.addCategory(category); 40 | } catch (BlogException e) { 41 | return e.getMessage(); 42 | } 43 | return "success"; 44 | } 45 | 46 | // ajax请求删除分类 47 | @RequestMapping(value = "/admin/category/{categoryId}", method = RequestMethod.DELETE) 48 | @ResponseBody 49 | public Map deleteCategory(@PathVariable(required = true) Integer categoryId) { 50 | Map map = new HashMap(); 51 | if (categoryId == null) { 52 | map.put("msg", "没有文章分类ID??"); 53 | } else { 54 | try { 55 | cs.deleteCategory(categoryId); 56 | map.put("msg", "success"); 57 | } catch (BlogException e) { 58 | map.put("msg", e.getMessage()); 59 | } 60 | } 61 | return map; 62 | } 63 | 64 | // ajax提交修改分类信息 65 | @RequestMapping(value = "/admin/category", method = RequestMethod.PUT) 66 | @ResponseBody 67 | public Map editCategory(Category category) { 68 | Map map = new HashMap(); 69 | if (category.getCategoryId() == null) { 70 | map.put("msg", "没有文章分类ID??"); 71 | } else if (MyUtils.checkempty(category.getCategoryName())) { 72 | map.put("msg", "分类名字不能为空。"); 73 | } else { 74 | cs.editCategory(category); 75 | map.put("msg", "修改成功!"); 76 | } 77 | return map; 78 | } 79 | 80 | // ajax请求文章分类 81 | @RequestMapping(value = "/category", method = RequestMethod.GET) 82 | @ResponseBody() 83 | public List getCategory() { 84 | List list = cs.queryCategoryList(); 85 | // 进行排序 86 | Collections.sort(list); 87 | return list; 88 | } 89 | 90 | // 后台 按文章分类展示分页 91 | @RequestMapping(value = "/admin/category/{categoryId}/p/{curr}", method = RequestMethod.GET) 92 | public String toarticleList(@PathVariable(required = true) Integer categoryId, 93 | @PathVariable(required = true) Integer curr, Model model) { 94 | if (curr < 1) 95 | return "forward:/admin/error"; 96 | Page
articlePage = as.queryArticlePageByCategory(categoryId, curr); 97 | model.addAttribute("articlePage", articlePage); 98 | model.addAttribute("categoryId", categoryId); 99 | return "admin/articlelist.jsp"; 100 | } 101 | 102 | // 后台 没页数转发到第一页 103 | @RequestMapping(value = "/admin/category/{categoryId}", method = RequestMethod.GET) 104 | public String toarticleList(@PathVariable(required = true) Integer categoryId) { 105 | return "forward:/admin/category/" + categoryId + "/p/1"; 106 | } 107 | 108 | // 前台 按文章分类展示分页 109 | @RequestMapping(value = "/category/{categoryId}/p/{curr}", method = RequestMethod.GET) 110 | public String toBlog(@PathVariable(required = true) Integer categoryId, @PathVariable(required = true) Integer curr, 111 | Model model) { 112 | if (curr < 1) 113 | return "forward:/error"; 114 | Page
articlePage = as.queryArticlePageByCategory(categoryId, curr); 115 | String categoryName; 116 | if (categoryId == 0) { 117 | categoryName = "All"; 118 | } else { 119 | categoryName = cs.queryCategoryNameById(categoryId); 120 | } 121 | model.addAttribute("articlePage", articlePage); 122 | model.addAttribute("categoryId", categoryId); 123 | model.addAttribute("categoryName", categoryName); 124 | return "index.jsp"; 125 | } 126 | 127 | // 前台 没页数转发到第一页 128 | @RequestMapping(value = "/category/{categoryId}", method = RequestMethod.GET) 129 | public String toBlog(@PathVariable(required = true) Integer categoryId) { 130 | return "forward:/category/" + categoryId + "/p/1"; 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/CommentController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.util.Date; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpSession; 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.ResponseBody; 18 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 19 | 20 | import com.frozen.myblog.pojo.Comment; 21 | import com.frozen.myblog.pojo.User; 22 | import com.frozen.myblog.service.CommentService; 23 | import com.frozen.myblog.service.UserService; 24 | import com.frozen.myblog.util.BlogException; 25 | import com.frozen.myblog.util.MyUtils; 26 | import com.frozen.myblog.util.Page; 27 | import com.frozen.myblog.util.VerifyCode; 28 | 29 | @Controller 30 | public class CommentController { 31 | @Autowired 32 | private CommentService cs; 33 | @Autowired 34 | private UserService us; 35 | //提交评论 36 | @RequestMapping(value = "/comment", method = RequestMethod.POST) 37 | @ResponseBody 38 | public Map submitComment(Comment comment, String verify, HttpSession session, 39 | HttpServletRequest req) { 40 | Map map = new HashMap(); 41 | try { 42 | // 校验表单 43 | if (MyUtils.checkempty(comment.getCommentContent())) 44 | throw new BlogException("评论内容不能为空"); 45 | if (comment.getArticleId() == null) 46 | throw new BlogException("文章Id不能为空"); 47 | if (!VerifyCode.confirmVerify(verify, session)) 48 | throw new BlogException("验证码错误"); 49 | // 检查是否登录 50 | User user = (User) session.getAttribute("user"); 51 | if (user == null) { 52 | // 确认游客用户名,注册为3-8字符,必定不重复 53 | String username = "游客" + req.getRemoteAddr().substring(0, 7); 54 | user = us.addVisitor(username); 55 | } 56 | comment.setCommentTime(new Date()); 57 | comment.setUsername(user.getUsername()); 58 | cs.addComment(comment); 59 | map.put("errno", "0"); 60 | } catch (Exception e) { 61 | e.printStackTrace(); 62 | map.put("errno", "1"); 63 | map.put("msg", e.getMessage()); 64 | } 65 | return map; 66 | } 67 | 68 | // 查看个人评论 69 | @RequestMapping(value = "/comment", method = RequestMethod.GET) 70 | public String personalComment(HttpSession session, Model model, RedirectAttributes attr) { 71 | User user = (User) session.getAttribute("user"); 72 | if (user != null) { 73 | List commentlist = cs.queryCommentListByUsername(user.getUsername()); 74 | model.addAttribute("list", commentlist); 75 | return "personalcomment.jsp"; 76 | } 77 | attr.addAttribute("msg", "你还未登录,没有权限!"); 78 | return "redirect:/error"; 79 | } 80 | 81 | // ajax请求最新评论 82 | @RequestMapping(value = "/newcomment", method = RequestMethod.GET) 83 | @ResponseBody 84 | public List getNewComment() { 85 | List list = cs.queryNewCommentList(); 86 | return list; 87 | } 88 | 89 | // 用户删除comment 90 | @RequestMapping(value = "/comment/{commentId}", method = RequestMethod.DELETE) 91 | @ResponseBody 92 | public Map deleteComment(@PathVariable Integer commentId, HttpSession session) { 93 | Map map = new HashMap(); 94 | try { 95 | // 取出session中的用户,确认是该用户删除的是自己的评论 96 | User user = (User) session.getAttribute("user"); 97 | cs.deleteCommentByIdByUser(commentId, user.getUsername()); 98 | map.put("errno", "0"); 99 | } catch (Exception e) { 100 | e.printStackTrace(); 101 | map.put("errno", "1"); 102 | map.put("msg", e.getMessage()); 103 | } 104 | return map; 105 | } 106 | 107 | // 管理员删除comment 108 | @RequestMapping(value = "/admin/comment/{commentId}", method = RequestMethod.DELETE) 109 | @ResponseBody 110 | public Map deleteComment(@PathVariable Integer commentId) { 111 | Map map = new HashMap(); 112 | try { 113 | cs.deleteCommentByIdByAdmin(commentId); 114 | map.put("errno", "0"); 115 | } catch (Exception e) { 116 | e.printStackTrace(); 117 | map.put("errno", "1"); 118 | map.put("msg", e.getMessage()); 119 | } 120 | return map; 121 | } 122 | 123 | //后台分页查看评论入口 124 | @RequestMapping(value = "/admin/comment",method=RequestMethod.GET) 125 | public String toAdminComment() { 126 | return "forward:/admin/comment/p/1"; 127 | } 128 | 129 | //分页查看评论 130 | @RequestMapping(value="/admin/comment/p/{curr}",method=RequestMethod.GET) 131 | public String adminComment(@PathVariable Integer curr,Model model) { 132 | Page commentPage = cs.queryCommentPage(curr); 133 | model.addAttribute("commentPage", commentPage); 134 | return "admin/comment.jsp"; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/LinkController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.ResponseBody; 14 | 15 | import com.frozen.myblog.pojo.Link; 16 | import com.frozen.myblog.service.LinkService; 17 | import com.frozen.myblog.util.BlogException; 18 | import com.frozen.myblog.util.MyUtils; 19 | 20 | @Controller 21 | public class LinkController { 22 | @Autowired 23 | private LinkService ls; 24 | 25 | // ajax查友链 26 | @RequestMapping(value = "/link", method = RequestMethod.GET) 27 | @ResponseBody 28 | public List getLink() throws InterruptedException { 29 | List list = ls.queryLink(); 30 | Collections.sort(list); 31 | return list; 32 | } 33 | 34 | // ajax提交友链表单 35 | @RequestMapping(value = "/admin/link", method = RequestMethod.POST) 36 | @ResponseBody 37 | public Map addLink(Link link) { 38 | Map map = new HashMap(); 39 | try { 40 | // 校验表单 41 | if (MyUtils.checkempty(link.getLink())) { 42 | throw new BlogException("链接不能为空!"); 43 | } 44 | if (MyUtils.checkempty(link.getLinkName())) { 45 | throw new BlogException("友链名称不能为空!"); 46 | } 47 | ls.addLink(link); 48 | map.put("errno", "0"); 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | map.put("errno", "1"); 52 | map.put("msg", e.getMessage()); 53 | } 54 | return map; 55 | } 56 | 57 | // ajax改友链信息 58 | @RequestMapping(value = "/admin/link", method = RequestMethod.PUT) 59 | @ResponseBody 60 | public Map editLink(Link link) { 61 | Map map = new HashMap(); 62 | try { 63 | // 校验表单 64 | if (link.getLinkId()==null) { 65 | throw new BlogException("没有友链Id!"); 66 | } 67 | if (MyUtils.checkempty(link.getLink())) { 68 | throw new BlogException("链接不能为空!"); 69 | } 70 | if (MyUtils.checkempty(link.getLinkName())) { 71 | throw new BlogException("友链名称不能为空!"); 72 | } 73 | ls.editLink(link); 74 | map.put("errno", "0"); 75 | } catch (Exception e) { 76 | e.printStackTrace(); 77 | map.put("errno", "1"); 78 | map.put("msg", e.getMessage()); 79 | } 80 | return map; 81 | } 82 | 83 | // ajax删友链 84 | @RequestMapping(value = "/admin/link/{linkId}", method = RequestMethod.DELETE) 85 | @ResponseBody 86 | public Map deleteLink(@PathVariable(required = true) Integer linkId) { 87 | Map map = new HashMap(); 88 | try { 89 | // errno 为0,代表无错 90 | ls.deleteLink(linkId); 91 | map.put("errno", "0"); 92 | } catch (Exception e) { 93 | // 出现异常 94 | e.printStackTrace(); 95 | map.put("errno", "1"); 96 | map.put("msg", e.getMessage()); 97 | } 98 | return map; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/MailController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | import com.frozen.myblog.pojo.MailPojo; 13 | import com.frozen.myblog.service.MailService; 14 | import com.frozen.myblog.util.BlogException; 15 | import com.frozen.myblog.util.MyUtils; 16 | 17 | @Controller 18 | public class MailController { 19 | @Autowired 20 | private MailService ms; 21 | //ajax的mail提交 22 | @RequestMapping(value = "/mail", method = RequestMethod.POST) 23 | @ResponseBody 24 | public Map sendMail(MailPojo mail) { 25 | Map map = new HashMap(); 26 | try { 27 | if (MyUtils.checkempty(mail.getMailContent())) { 28 | throw new BlogException("内容不能为空"); 29 | } 30 | if (MyUtils.checkempty(mail.getMailTitle())) { 31 | throw new BlogException("标题不能为空"); 32 | } 33 | ms.sendMail(mail); 34 | map.put("errno", "0"); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | map.put("errno", "1"); 38 | map.put("msg", e.getMessage()); 39 | } 40 | return map; 41 | } 42 | //查找收到多少邮件 43 | @RequestMapping(value = "/admin/mail", method = RequestMethod.GET) 44 | @ResponseBody 45 | public Integer getMailNum() { 46 | return ms.getMailNum(); 47 | } 48 | //清除mailNum 49 | @RequestMapping(value = "/admin/clearMailNum", method = RequestMethod.GET) 50 | public String clearMailNum() { 51 | ms.setMailNumZero(); 52 | //重定向至126邮箱 53 | return "redirect:https://mail.126.com"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/controller/VerifyCodeController.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.controller; 2 | 3 | import java.io.IOException; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | import com.frozen.myblog.util.VerifyCode; 15 | 16 | @Controller 17 | public class VerifyCodeController { 18 | @RequestMapping("/getVerifyCode") 19 | public void getVerifyCode(HttpSession session, HttpServletResponse resp) { 20 | // 生成验证码 21 | VerifyCode vc = new VerifyCode(); 22 | String code = vc.getCode(); 23 | // 将验证码保存至session中 24 | session.setAttribute("code", code); 25 | try { 26 | vc.write(resp.getOutputStream()); 27 | } catch (IOException e) { 28 | e.printStackTrace(); 29 | } 30 | } 31 | //ajax校验验证码 32 | @RequestMapping("/confirmVerify") 33 | @ResponseBody() 34 | public Map confirmVerify(String verify, HttpSession session) { 35 | Map map = new HashMap(); 36 | // 验证码是否输入正确 37 | if (VerifyCode.confirmVerify(verify, session)) { 38 | map.put("valid", "true"); 39 | } else { 40 | map.put("valid", "false"); 41 | } 42 | return map; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/ArticleMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.frozen.myblog.pojo.Article; 7 | 8 | public interface ArticleMapper { 9 | void saveArticle(Article article); 10 | 11 | Integer queryCountByCategory(Integer categoryId); 12 | 13 | List
queryArticleList(); 14 | 15 | List queryArticlePage(Map parameterMap); 16 | 17 | void deleteArticleById(Integer articleId); 18 | 19 | void updateArticle(Article article); 20 | 21 | Integer queryCountByParameter(String q); 22 | 23 | Article queryPreArticle(Integer articleId); 24 | 25 | Article queryNextArticle(Integer articleId); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/ArticleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 42 | 43 | 50 | 51 | 65 | 66 | 75 | 76 | 85 | 86 | 87 | 89 | SELECT LAST_INSERT_ID(); 90 | 91 | INSERT INTO t_article 92 | (article_title,article_brief,article_content,article_time,category_id) 93 | VALUES(#{articleTitle},#{articleBrief},#{articleContent},#{articleTime},#{category.categoryId}); 94 | 95 | 96 | DELETE FROM 97 | t_article WHERE article_id = #{value}; 98 | 99 | 100 | 101 | UPDATE t_article 102 | 103 | 104 | article_title = #{articleTitle}, 105 | 106 | 107 | article_brief = #{articleBrief}, 108 | 109 | 110 | article_content = #{articleContent}, 111 | 112 | 113 | article_time = #{articleTime}, 114 | 115 | 116 | category_id = #{category.categoryId} 117 | 118 | 119 | WHERE article_id = #{articleId}; 120 | 121 | 122 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CarouselMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Carousel; 6 | 7 | public interface CarouselMapper { 8 | 9 | void save(Carousel carousel); 10 | 11 | List queryCarouselList(); 12 | 13 | void updateCarousel(Carousel carousel); 14 | 15 | void deleteCarouselById(Integer carouselId); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CarouselMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | SELECT LAST_INSERT_ID(); 19 | 20 | INSERT INTO t_carousel 21 | (carousel_url,carousel_author,carousel_sign,carousel_order) 22 | VALUES(#{carouselUrl},#{carouselAuthor},#{carouselSign},#{carouselOrder}); 23 | 24 | 25 | 26 | UPDATE t_carousel 27 | 28 | 29 | carousel_author =#{carouselAuthor} 30 | 31 | 32 | carousel_sign =#{carouselSign} 33 | 34 | 35 | carousel_order = #{carouselOrder} 36 | 37 | 38 | WHERE carousel_id = #{carouselId}; 39 | 40 | 41 | 42 | DELETE FROM t_carousel WHERE carousel_id = #{value}; 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Category; 6 | 7 | public interface CategoryMapper { 8 | 9 | Integer queryIdByName(String categoryName); 10 | 11 | void saveCategory(Category category); 12 | 13 | List queryCategoryList(); 14 | 15 | void deleteCategoryByID(Integer categoryId); 16 | 17 | void updateCategory(Category category); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | SELECT LAST_INSERT_ID(); 12 | 13 | INSERT INTO t_category 14 | (category_name) VALUES (#{categoryName}); 15 | 16 | 17 | 22 | 23 | 26 | 27 | 28 | DELETE FROM 29 | t_category 30 | WHERE category_id = #{value}; 31 | 32 | 33 | 34 | UPDATE t_category 35 | SET category_name = #{categoryName} 36 | WHERE category_id = #{categoryId}; 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CommentMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.frozen.myblog.pojo.Comment; 7 | 8 | public interface CommentMapper { 9 | 10 | void saveComment(Comment comment); 11 | 12 | List queryCommentList(); 13 | 14 | List queryCommentIdListByUserName(String username); 15 | 16 | List queryNewCommentId(); 17 | 18 | void deleteCommentById(Integer commentId); 19 | 20 | List queryPageCommentIdList(Map parameterMap); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/CommentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | SELECT LAST_INSERT_ID(); 15 | 16 | INSERT INTO t_comment 17 | (comment_content,comment_time,username,article_id) 18 | VALUES 19 | (#{commentContent},#{commentTime},#{username},#{articleId}); 20 | 21 | 22 | 25 | 26 | 29 | 30 | 33 | 34 | 35 | DELETE FROM t_comment WHERE comment_id = #{commentId}; 36 | 37 | 38 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/LinkMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Link; 6 | 7 | public interface LinkMapper { 8 | List queryLinkList(); 9 | 10 | void updateLink(Link link); 11 | 12 | void deleteLinkById(Integer linkId); 13 | 14 | void addLink(Link link); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/LinkMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | SELECT LAST_INSERT_ID(); 17 | 18 | INSERT INTO t_link 19 | (link,link_name) 20 | VALUES (#{link},#{linkName}); 21 | 22 | 23 | 24 | UPDATE t_link 25 | 26 | 27 | link_name = #{linkName}, 28 | 29 | 30 | link = #{link} 31 | 32 | 33 | WHERE link_id = #{linkId}; 34 | 35 | 36 | 37 | DELETE FROM t_link WHERE link_id = #{value}; 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.mapper; 2 | 3 | import com.frozen.myblog.pojo.User; 4 | 5 | public interface UserMapper { 6 | 7 | User queryUserByUsername(String username); 8 | //检查数据库是否存在该用户名,不存在返回null 9 | Integer query1ByUsername(String username); 10 | 11 | void saveUser(User user); 12 | 13 | void saveVisitor(String username); 14 | 15 | Integer queryCount(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 11 | 12 | INSERT INTO t_user 13 | (username ,password) 14 | VALUES 15 | (#{username},#{password}); 16 | 17 | 18 | 19 | INSERT INTO t_user 20 | (username) 21 | VALUES 22 | (#{value}); 23 | 24 | 25 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/Article.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | public class Article implements Serializable { 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = 1L; 12 | private Integer articleId; 13 | private String articleTitle; 14 | private String articleBrief; 15 | private String articleContent; 16 | private Date articleTime; 17 | private Category category; 18 | 19 | // 不进行序列化,否则在list上添加删除回复,会出现线程安全问题 20 | private transient List commentList; 21 | // 用于存储评论数量,不进行序列化 22 | private transient Integer commentCount; 23 | 24 | // 用于存放上一篇和下一篇文章信息,不进行序列化 25 | private transient Article pre; 26 | private transient Article next; 27 | 28 | public Integer getCommentCount() { 29 | return commentCount; 30 | } 31 | 32 | public void setCommentCount(Integer commentCount) { 33 | this.commentCount = commentCount; 34 | } 35 | 36 | public Integer getArticleId() { 37 | return articleId; 38 | } 39 | 40 | public void setArticleId(Integer articleId) { 41 | this.articleId = articleId; 42 | } 43 | 44 | public String getArticleTitle() { 45 | return articleTitle; 46 | } 47 | 48 | public void setArticleTitle(String articleTitle) { 49 | this.articleTitle = articleTitle; 50 | } 51 | 52 | public String getArticleBrief() { 53 | return articleBrief; 54 | } 55 | 56 | public void setArticleBrief(String articleBrief) { 57 | this.articleBrief = articleBrief; 58 | } 59 | 60 | public String getArticleContent() { 61 | return articleContent; 62 | } 63 | 64 | public void setArticleContent(String articleContent) { 65 | this.articleContent = articleContent; 66 | } 67 | 68 | public Date getArticleTime() { 69 | return articleTime; 70 | } 71 | 72 | public void setArticleTime(Date articleTime) { 73 | this.articleTime = articleTime; 74 | } 75 | 76 | public Category getCategory() { 77 | return category; 78 | } 79 | 80 | public void setCategory(Category category) { 81 | this.category = category; 82 | } 83 | 84 | @Override 85 | public int hashCode() { 86 | final int prime = 31; 87 | int result = 1; 88 | result = prime * result + ((articleBrief == null) ? 0 : articleBrief.hashCode()); 89 | result = prime * result + ((articleContent == null) ? 0 : articleContent.hashCode()); 90 | result = prime * result + ((articleId == null) ? 0 : articleId.hashCode()); 91 | result = prime * result + ((articleTime == null) ? 0 : articleTime.hashCode()); 92 | result = prime * result + ((articleTitle == null) ? 0 : articleTitle.hashCode()); 93 | result = prime * result + ((category == null) ? 0 : category.hashCode()); 94 | return result; 95 | } 96 | 97 | @Override 98 | public boolean equals(Object obj) { 99 | if (this == obj) 100 | return true; 101 | if (obj == null) 102 | return false; 103 | if (getClass() != obj.getClass()) 104 | return false; 105 | Article other = (Article) obj; 106 | if (articleBrief == null) { 107 | if (other.articleBrief != null) 108 | return false; 109 | } else if (!articleBrief.equals(other.articleBrief)) 110 | return false; 111 | if (articleContent == null) { 112 | if (other.articleContent != null) 113 | return false; 114 | } else if (!articleContent.equals(other.articleContent)) 115 | return false; 116 | if (articleId == null) { 117 | if (other.articleId != null) 118 | return false; 119 | } else if (!articleId.equals(other.articleId)) 120 | return false; 121 | if (articleTime == null) { 122 | if (other.articleTime != null) 123 | return false; 124 | } else if (!articleTime.equals(other.articleTime)) 125 | return false; 126 | if (articleTitle == null) { 127 | if (other.articleTitle != null) 128 | return false; 129 | } else if (!articleTitle.equals(other.articleTitle)) 130 | return false; 131 | if (category == null) { 132 | if (other.category != null) 133 | return false; 134 | } else if (!category.equals(other.category)) 135 | return false; 136 | return true; 137 | } 138 | 139 | @Override 140 | public String toString() { 141 | return "Article [articleId=" + articleId + ", articleTitle=" + articleTitle + ", articleBrief=" + articleBrief 142 | + ", articleContent=" + articleContent + ", articleTime=" + articleTime + ", category=" + category 143 | + "]"; 144 | } 145 | 146 | public List getCommentList() { 147 | return commentList; 148 | } 149 | 150 | public void setCommentList(List commentList) { 151 | this.commentList = commentList; 152 | } 153 | 154 | public Article getPre() { 155 | return pre; 156 | } 157 | 158 | public void setPre(Article pre) { 159 | this.pre = pre; 160 | } 161 | 162 | public Article getNext() { 163 | return next; 164 | } 165 | 166 | public void setNext(Article next) { 167 | this.next = next; 168 | } 169 | 170 | } 171 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/Carousel.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Carousel implements Serializable, Comparable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | private Integer carouselId; 9 | private String carouselUrl; 10 | private String carouselAuthor; 11 | private String carouselSign; 12 | private Integer carouselOrder; 13 | 14 | public Integer getCarouselId() { 15 | return carouselId; 16 | } 17 | 18 | public void setCarouselId(Integer carouselId) { 19 | this.carouselId = carouselId; 20 | } 21 | 22 | public String getCarouselAuthor() { 23 | return carouselAuthor; 24 | } 25 | 26 | public void setCarouselAuthor(String carouselAuthor) { 27 | this.carouselAuthor = carouselAuthor; 28 | } 29 | 30 | public String getCarouselSign() { 31 | return carouselSign; 32 | } 33 | 34 | public void setCarouselSign(String carouselSign) { 35 | this.carouselSign = carouselSign; 36 | } 37 | 38 | public Integer getCarouselOrder() { 39 | return carouselOrder; 40 | } 41 | 42 | public void setCarouselOrder(Integer carouselOrder) { 43 | this.carouselOrder = carouselOrder; 44 | } 45 | 46 | public String getCarouselUrl() { 47 | return carouselUrl; 48 | } 49 | 50 | public void setCarouselUrl(String carouselUrl) { 51 | this.carouselUrl = carouselUrl; 52 | } 53 | 54 | @Override 55 | public int hashCode() { 56 | final int prime = 31; 57 | int result = 1; 58 | result = prime * result + ((carouselAuthor == null) ? 0 : carouselAuthor.hashCode()); 59 | result = prime * result + ((carouselId == null) ? 0 : carouselId.hashCode()); 60 | result = prime * result + ((carouselOrder == null) ? 0 : carouselOrder.hashCode()); 61 | result = prime * result + ((carouselSign == null) ? 0 : carouselSign.hashCode()); 62 | result = prime * result + ((carouselUrl == null) ? 0 : carouselUrl.hashCode()); 63 | return result; 64 | } 65 | 66 | @Override 67 | public boolean equals(Object obj) { 68 | if (this == obj) 69 | return true; 70 | if (obj == null) 71 | return false; 72 | if (getClass() != obj.getClass()) 73 | return false; 74 | Carousel other = (Carousel) obj; 75 | if (carouselAuthor == null) { 76 | if (other.carouselAuthor != null) 77 | return false; 78 | } else if (!carouselAuthor.equals(other.carouselAuthor)) 79 | return false; 80 | if (carouselId == null) { 81 | if (other.carouselId != null) 82 | return false; 83 | } else if (!carouselId.equals(other.carouselId)) 84 | return false; 85 | if (carouselOrder == null) { 86 | if (other.carouselOrder != null) 87 | return false; 88 | } else if (!carouselOrder.equals(other.carouselOrder)) 89 | return false; 90 | if (carouselSign == null) { 91 | if (other.carouselSign != null) 92 | return false; 93 | } else if (!carouselSign.equals(other.carouselSign)) 94 | return false; 95 | if (carouselUrl == null) { 96 | if (other.carouselUrl != null) 97 | return false; 98 | } else if (!carouselUrl.equals(other.carouselUrl)) 99 | return false; 100 | return true; 101 | } 102 | 103 | @Override 104 | public String toString() { 105 | return "Carousel [carouselId=" + carouselId + ", carouselUrl=" + carouselUrl + ", carouselAuthor=" 106 | + carouselAuthor + ", carouselSign=" + carouselSign + ", carouselOrder=" + carouselOrder + "]"; 107 | } 108 | 109 | @Override 110 | public int compareTo(Carousel c) { 111 | if (this.carouselOrder == c.carouselOrder) { 112 | return 0; 113 | } 114 | if (c.carouselOrder == null) { 115 | return -1; 116 | } 117 | if (this.carouselOrder == null) { 118 | return 1; 119 | } 120 | return this.carouselOrder - c.carouselOrder; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/Category.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonInclude.Include; 7 | 8 | public class Category implements Serializable, Comparable { 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = 1L; 13 | private Integer categoryId; 14 | private String categoryName; 15 | // 用于存储该分类下文章的数量,不被序列化,也不参与hashcode和equals 16 | // Json注解,字段为空时,不进行转换 17 | @JsonInclude(value = Include.NON_NULL) 18 | private transient Integer count; 19 | 20 | public Integer getCategoryId() { 21 | return categoryId; 22 | } 23 | 24 | public void setCategoryId(Integer categoryId) { 25 | this.categoryId = categoryId; 26 | } 27 | 28 | public String getCategoryName() { 29 | return categoryName; 30 | } 31 | 32 | public void setCategoryName(String categoryName) { 33 | this.categoryName = categoryName; 34 | } 35 | 36 | public Integer getCount() { 37 | return count; 38 | } 39 | 40 | public void setCount(Integer count) { 41 | this.count = count; 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | final int prime = 31; 47 | int result = 1; 48 | result = prime * result + ((categoryId == null) ? 0 : categoryId.hashCode()); 49 | result = prime * result + ((categoryName == null) ? 0 : categoryName.hashCode()); 50 | return result; 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | if (this == obj) 56 | return true; 57 | if (obj == null) 58 | return false; 59 | if (getClass() != obj.getClass()) 60 | return false; 61 | Category other = (Category) obj; 62 | if (categoryId == null) { 63 | if (other.categoryId != null) 64 | return false; 65 | } else if (!categoryId.equals(other.categoryId)) 66 | return false; 67 | if (categoryName == null) { 68 | if (other.categoryName != null) 69 | return false; 70 | } else if (!categoryName.equals(other.categoryName)) 71 | return false; 72 | return true; 73 | } 74 | 75 | @Override 76 | public int compareTo(Category c) { 77 | if (this.categoryId == c.categoryId) 78 | return 0; 79 | if (c.categoryId == null) 80 | return -1; 81 | if (this.categoryId == null) 82 | return 1; 83 | return this.getCategoryId() - c.getCategoryId(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/Comment.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | public class Comment implements Serializable,Comparable{ 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = 1L; 13 | //转化json时的不转化属性 14 | @JsonIgnore 15 | private Integer commentId; 16 | private String commentContent; 17 | @JsonIgnore 18 | private Date commentTime; 19 | private String username; 20 | @JsonIgnore 21 | private Integer articleId; 22 | 23 | public Integer getCommentId() { 24 | return commentId; 25 | } 26 | 27 | public void setCommentId(Integer commentId) { 28 | this.commentId = commentId; 29 | } 30 | 31 | public String getCommentContent() { 32 | return commentContent; 33 | } 34 | 35 | public void setCommentContent(String commentContent) { 36 | this.commentContent = commentContent; 37 | } 38 | 39 | public Date getCommentTime() { 40 | return commentTime; 41 | } 42 | 43 | public void setCommentTime(Date commentTime) { 44 | this.commentTime = commentTime; 45 | } 46 | 47 | 48 | public String getUsername() { 49 | return username; 50 | } 51 | 52 | public void setUsername(String username) { 53 | this.username = username; 54 | } 55 | 56 | public Integer getArticleId() { 57 | return articleId; 58 | } 59 | 60 | public void setArticleId(Integer articleId) { 61 | this.articleId = articleId; 62 | } 63 | 64 | @Override 65 | public int hashCode() { 66 | final int prime = 31; 67 | int result = 1; 68 | result = prime * result + ((articleId == null) ? 0 : articleId.hashCode()); 69 | result = prime * result + ((commentContent == null) ? 0 : commentContent.hashCode()); 70 | result = prime * result + ((commentId == null) ? 0 : commentId.hashCode()); 71 | result = prime * result + ((commentTime == null) ? 0 : commentTime.hashCode()); 72 | result = prime * result + ((username == null) ? 0 : username.hashCode()); 73 | return result; 74 | } 75 | 76 | @Override 77 | public boolean equals(Object obj) { 78 | if (this == obj) 79 | return true; 80 | if (obj == null) 81 | return false; 82 | if (getClass() != obj.getClass()) 83 | return false; 84 | Comment other = (Comment) obj; 85 | if (articleId == null) { 86 | if (other.articleId != null) 87 | return false; 88 | } else if (!articleId.equals(other.articleId)) 89 | return false; 90 | if (commentContent == null) { 91 | if (other.commentContent != null) 92 | return false; 93 | } else if (!commentContent.equals(other.commentContent)) 94 | return false; 95 | if (commentId == null) { 96 | if (other.commentId != null) 97 | return false; 98 | } else if (!commentId.equals(other.commentId)) 99 | return false; 100 | if (commentTime == null) { 101 | if (other.commentTime != null) 102 | return false; 103 | } else if (!commentTime.equals(other.commentTime)) 104 | return false; 105 | if (username == null) { 106 | if (other.username != null) 107 | return false; 108 | } else if (!username.equals(other.username)) 109 | return false; 110 | return true; 111 | } 112 | 113 | @Override 114 | public String toString() { 115 | return "Comment [commentId=" + commentId + ", commentContent=" + commentContent + ", commentTime=" + commentTime 116 | + ", username=" + username + ", articleId=" + articleId + "]"; 117 | } 118 | 119 | @Override 120 | public int compareTo(Comment c) { 121 | //逆序排列 122 | return - this.getCommentTime().compareTo(c.getCommentTime()); 123 | } 124 | 125 | 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/Link.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Link implements Serializable, Comparable { 6 | /** 7 | * 8 | */ 9 | private static final long serialVersionUID = 1L; 10 | private Integer linkId; 11 | private String link; 12 | private String linkName; 13 | 14 | public String getLink() { 15 | return link; 16 | } 17 | 18 | public void setLink(String link) { 19 | this.link = link; 20 | } 21 | 22 | public Integer getLinkId() { 23 | return linkId; 24 | } 25 | 26 | public void setLinkId(Integer linkId) { 27 | this.linkId = linkId; 28 | } 29 | 30 | public String getLinkName() { 31 | return linkName; 32 | } 33 | 34 | public void setLinkName(String linkName) { 35 | this.linkName = linkName; 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | final int prime = 31; 41 | int result = 1; 42 | result = prime * result + ((link == null) ? 0 : link.hashCode()); 43 | result = prime * result + ((linkId == null) ? 0 : linkId.hashCode()); 44 | result = prime * result + ((linkName == null) ? 0 : linkName.hashCode()); 45 | return result; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object obj) { 50 | if (this == obj) 51 | return true; 52 | if (obj == null) 53 | return false; 54 | if (getClass() != obj.getClass()) 55 | return false; 56 | Link other = (Link) obj; 57 | if (link == null) { 58 | if (other.link != null) 59 | return false; 60 | } else if (!link.equals(other.link)) 61 | return false; 62 | if (linkId == null) { 63 | if (other.linkId != null) 64 | return false; 65 | } else if (!linkId.equals(other.linkId)) 66 | return false; 67 | if (linkName == null) { 68 | if (other.linkName != null) 69 | return false; 70 | } else if (!linkName.equals(other.linkName)) 71 | return false; 72 | return true; 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return "Link [linkId=" + linkId + ", link=" + link + ", linkName=" + linkName + "]"; 78 | } 79 | 80 | @Override 81 | public int compareTo(Link i) { 82 | if (this.linkId == i.linkId) 83 | return 0; 84 | if (i.linkId == null) 85 | return -1; 86 | if (this.linkId == null) 87 | return 1; 88 | return this.linkId - i.linkId; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/MailPojo.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | public class MailPojo { 4 | private String mailTitle; 5 | private String mailContent; 6 | public String getMailTitle() { 7 | return mailTitle; 8 | } 9 | public void setMailTitle(String mailTitle) { 10 | this.mailTitle = mailTitle; 11 | } 12 | public String getMailContent() { 13 | return mailContent; 14 | } 15 | public void setMailContent(String mailContent) { 16 | this.mailContent = mailContent; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.pojo; 2 | 3 | import java.io.Serializable; 4 | 5 | public class User implements Serializable { 6 | /** 7 | * 8 | */ 9 | private static final long serialVersionUID = 1L; 10 | private String username; 11 | private String password; 12 | private Integer permission; 13 | 14 | public String getUsername() { 15 | return username; 16 | } 17 | 18 | public void setUsername(String username) { 19 | this.username = username; 20 | } 21 | 22 | public String getPassword() { 23 | return password; 24 | } 25 | 26 | public void setPassword(String password) { 27 | this.password = password; 28 | } 29 | 30 | public Integer getPermission() { 31 | return permission; 32 | } 33 | 34 | public void setPermission(Integer permission) { 35 | this.permission = permission; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "User [username=" + username + ", password=" + password + ", permission=" + permission + "]"; 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | final int prime = 31; 46 | int result = 1; 47 | result = prime * result + ((password == null) ? 0 : password.hashCode()); 48 | result = prime * result + ((permission == null) ? 0 : permission.hashCode()); 49 | result = prime * result + ((username == null) ? 0 : username.hashCode()); 50 | return result; 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | if (this == obj) 56 | return true; 57 | if (obj == null) 58 | return false; 59 | if (getClass() != obj.getClass()) 60 | return false; 61 | User other = (User) obj; 62 | if (password == null) { 63 | if (other.password != null) 64 | return false; 65 | } else if (!password.equals(other.password)) 66 | return false; 67 | if (permission == null) { 68 | if (other.permission != null) 69 | return false; 70 | } else if (!permission.equals(other.permission)) 71 | return false; 72 | if (username == null) { 73 | if (other.username != null) 74 | return false; 75 | } else if (!username.equals(other.username)) 76 | return false; 77 | return true; 78 | } 79 | 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/ArticleService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import com.frozen.myblog.pojo.Article; 4 | import com.frozen.myblog.util.BlogException; 5 | import com.frozen.myblog.util.Page; 6 | 7 | public interface ArticleService { 8 | public void saveArticle(Article article); 9 | 10 | public void deleteArticle(Integer articleId); 11 | 12 | public Article queryArticleById(Integer articleId); 13 | 14 | public void editArticle(Article article); 15 | 16 | Page
queryArticlePageByCategory(Integer categoryId, Integer curr); 17 | 18 | public Page
queryArticlePageByParameter(String q, Integer curr); 19 | 20 | public Article queryArticleDetail(Integer articleId) throws BlogException; 21 | 22 | public Integer queryArticleCount(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/CarouselService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Carousel; 6 | 7 | public interface CarouselService { 8 | 9 | void saveCarousel(Carousel carousel); 10 | 11 | List queryCarousel(); 12 | 13 | void editCarousel(Carousel carousel); 14 | 15 | Carousel deleteCarousel(Integer carouselId); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Category; 6 | import com.frozen.myblog.util.BlogException; 7 | 8 | public interface CategoryService { 9 | 10 | void addCategory(Category category) throws BlogException; 11 | 12 | List queryCategoryAndArticleCount(); 13 | 14 | void deleteCategory(Integer categoryId) throws BlogException; 15 | 16 | void editCategory(Category category); 17 | 18 | List queryCategoryList(); 19 | 20 | String queryCategoryNameById(Integer categoryId); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/CommentService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Comment; 6 | import com.frozen.myblog.util.BlogException; 7 | import com.frozen.myblog.util.Page; 8 | 9 | public interface CommentService { 10 | 11 | void addComment(Comment comment); 12 | 13 | List queryCommentListByUsername(String username); 14 | 15 | List queryNewCommentList(); 16 | 17 | void deleteCommentByIdByUser(Integer commentId,String username) throws BlogException; 18 | 19 | Integer queryCommentCount(); 20 | 21 | Page queryCommentPage(Integer curr); 22 | 23 | void deleteCommentByIdByAdmin(Integer commentId); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/LinkService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import java.util.List; 4 | 5 | import com.frozen.myblog.pojo.Link; 6 | 7 | public interface LinkService { 8 | 9 | List queryLink(); 10 | 11 | void editLink(Link link); 12 | 13 | void deleteLink(Integer linkId); 14 | 15 | void addLink(Link link); 16 | 17 | Integer queryLinkCount(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/MailService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import javax.mail.MessagingException; 4 | 5 | import com.frozen.myblog.pojo.MailPojo; 6 | 7 | public interface MailService { 8 | 9 | void sendMail(MailPojo mail) throws MessagingException; 10 | 11 | Integer getMailNum(); 12 | 13 | void setMailNumZero(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service; 2 | 3 | import com.frozen.myblog.pojo.User; 4 | import com.frozen.myblog.util.BlogException; 5 | 6 | public interface UserService { 7 | User login(User user) throws BlogException; 8 | 9 | void register(User user) throws BlogException; 10 | 11 | boolean existUsername(String username) throws BlogException; 12 | 13 | User addVisitor(String username); 14 | 15 | Integer queryUserCount(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/CarouselServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.data.redis.core.HashOperations; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.stereotype.Service; 13 | 14 | import com.frozen.myblog.mapper.CarouselMapper; 15 | import com.frozen.myblog.pojo.Carousel; 16 | import com.frozen.myblog.service.CarouselService; 17 | import com.frozen.myblog.util.MyUtils; 18 | 19 | @Service 20 | public class CarouselServiceImpl implements CarouselService { 21 | @Autowired 22 | CarouselMapper cm; 23 | @Resource(name="redisTemplate") 24 | RedisTemplate rt; 25 | 26 | @Override 27 | public void saveCarousel(Carousel carousel) { 28 | saveCarouselIfNotExist(); 29 | cm.save(carousel); 30 | rt.opsForHash().putIfAbsent("carouselHash", carousel.getCarouselId(), carousel); 31 | } 32 | 33 | @Override 34 | public List queryCarousel() { 35 | saveCarouselIfNotExist(); 36 | HashOperations ops = rt.opsForHash(); 37 | return ops.values("carouselHash"); 38 | } 39 | 40 | @Override 41 | public void editCarousel(Carousel carousel) { 42 | //数据库更新 43 | cm.updateCarousel(carousel); 44 | HashOperations ops = rt.opsForHash(); 45 | Integer carouselId =carousel.getCarouselId(); 46 | //若redis中存在该条数据,进行redis更新 47 | if(ops.hasKey("carouselHash",carouselId)) { 48 | Carousel oldCarousel = ops.get("carouselHash", carouselId); 49 | //把不是空值的字段赋给原始carousel 50 | if(!MyUtils.checkempty(carousel.getCarouselAuthor())) { 51 | oldCarousel.setCarouselAuthor(carousel.getCarouselAuthor()); 52 | } 53 | if(!MyUtils.checkempty(carousel.getCarouselSign())) { 54 | oldCarousel.setCarouselSign(carousel.getCarouselSign()); 55 | } 56 | if(carousel.getCarouselOrder()!=null) { 57 | oldCarousel.setCarouselOrder(carousel.getCarouselOrder()); 58 | } 59 | //覆盖 60 | ops.put("carouselHash", carouselId, oldCarousel); 61 | } 62 | } 63 | 64 | @Override 65 | public Carousel deleteCarousel(Integer carouselId) { 66 | cm.deleteCarouselById(carouselId); 67 | HashOperations ops=rt.opsForHash(); 68 | //取出要删除的carousel,便于controller层删除图片。 69 | Carousel carousel = ops.get("carouselHash", carouselId); 70 | ops.delete("carouselHash", carouselId); 71 | return carousel; 72 | } 73 | 74 | // 检查是否存在carouselHash,不存在则存储 75 | private void saveCarouselIfNotExist() { 76 | if (!rt.hasKey("carouselHash")) { 77 | Map map = new HashMap(); 78 | for (Carousel c : cm.queryCarouselList()) { 79 | map.put(c.getCarouselId(), c); 80 | } 81 | rt.opsForHash().putAll("carouselHash", map); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.data.redis.core.HashOperations; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.stereotype.Service; 13 | 14 | import com.frozen.myblog.mapper.ArticleMapper; 15 | import com.frozen.myblog.mapper.CategoryMapper; 16 | import com.frozen.myblog.pojo.Category; 17 | import com.frozen.myblog.service.CategoryService; 18 | import com.frozen.myblog.util.BlogException; 19 | 20 | @Service 21 | public class CategoryServiceImpl implements CategoryService { 22 | @Autowired 23 | private CategoryMapper cm; 24 | @Autowired 25 | private ArticleMapper am; 26 | @Resource(name="redisTemplate") 27 | private RedisTemplate rt; 28 | 29 | // 新增category 30 | @Override 31 | public void addCategory(Category category) throws BlogException { 32 | if (cm.queryIdByName(category.getCategoryName()) != null) { 33 | throw new BlogException("该文章分类已存在。"); 34 | } 35 | saveCategoryIfNotExist(); 36 | // 存进数据库后,category已查询到添加的ID 37 | cm.saveCategory(category); 38 | // redis存储新增category 39 | HashOperations ops = rt.opsForHash(); 40 | // 将category_id作为hashkey 41 | ops.put("categoryHash", category.getCategoryId(), category); 42 | } 43 | 44 | // 查询category及对应的文章数量 45 | @Override 46 | public List queryCategoryAndArticleCount() { 47 | // 查询categorylist 48 | List categorylist = this.queryCategoryList(); 49 | // 查询分类下的文章数量 50 | for (Category c : categorylist) { 51 | c.setCount(am.queryCountByCategory(c.getCategoryId())); 52 | } 53 | return categorylist; 54 | } 55 | 56 | // 删除 57 | @Override 58 | public void deleteCategory(Integer categoryId) throws BlogException { 59 | if (am.queryCountByCategory(categoryId) > 0) { 60 | throw new BlogException("该文章分类下还有文章,无法删除。"); 61 | } 62 | cm.deleteCategoryByID(categoryId); 63 | rt.opsForHash().delete("categoryHash", categoryId); 64 | } 65 | 66 | // 修改 67 | @Override 68 | public void editCategory(Category category) { 69 | cm.updateCategory(category); 70 | HashOperations ops = rt.opsForHash(); 71 | // 如果存在该ID,进行覆盖操作,否则不操作 72 | if (ops.hasKey("categoryHash", category.getCategoryId())) { 73 | ops.put("categoryHash", category.getCategoryId(), category); 74 | } 75 | } 76 | 77 | @Override 78 | public List queryCategoryList() { 79 | HashOperations ops = rt.opsForHash(); 80 | // 不存在categoryHash,查询数据库,并存进redis 81 | saveCategoryIfNotExist(); 82 | // 从categoryhash取出 83 | List categorylist = ops.values("categoryHash"); 84 | return categorylist; 85 | } 86 | 87 | @Override 88 | public String queryCategoryNameById(Integer categoryId) { 89 | saveCategoryIfNotExist(); 90 | HashOperations ops = rt.opsForHash(); 91 | return ops.get("categoryHash", categoryId).getCategoryName(); 92 | } 93 | 94 | // 检查是否存在categoryHash,不存在则存储 95 | private void saveCategoryIfNotExist() { 96 | if (!rt.hasKey("categoryHash")) { 97 | Map map = new HashMap(); 98 | // 封装categorylist加入map操作 99 | for (Category c : cm.queryCategoryList()) { 100 | map.put(c.getCategoryId(), c); 101 | } 102 | rt.opsForHash().putAll("categoryHash", map); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/CommentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.data.redis.core.HashOperations; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.stereotype.Service; 13 | 14 | import com.frozen.myblog.mapper.CommentMapper; 15 | import com.frozen.myblog.pojo.Comment; 16 | import com.frozen.myblog.service.CommentService; 17 | import com.frozen.myblog.util.BlogException; 18 | import com.frozen.myblog.util.Page; 19 | 20 | @Service 21 | public class CommentServiceImpl implements CommentService { 22 | @Autowired 23 | private CommentMapper cm; 24 | @Resource(name="redisTemplate") 25 | private RedisTemplate rt; 26 | 27 | @Override 28 | public void addComment(Comment comment) { 29 | // 保存评论 30 | saveCommentIfNotExist(); 31 | cm.saveComment(comment); 32 | rt.opsForHash().put("commentHash", comment.getCommentId(), comment); 33 | // 将评论置于该article的redis list中 34 | //存入的评论和文章存入时保持同步,不存articleId 35 | Integer articleId = comment.getArticleId(); 36 | comment.setArticleId(null); 37 | rt.opsForList().leftPush("article" + articleId, comment); 38 | 39 | } 40 | 41 | // 查个人评论 42 | @Override 43 | public List queryCommentListByUsername(String username) { 44 | saveCommentIfNotExist(); 45 | List idlist = cm.queryCommentIdListByUserName(username); 46 | HashOperations ops = rt.opsForHash(); 47 | List commentlist; 48 | commentlist = ops.multiGet("commentHash", idlist); 49 | return commentlist; 50 | } 51 | 52 | // 查最新评论 53 | @Override 54 | public List queryNewCommentList() { 55 | saveCommentIfNotExist(); 56 | List idlist = cm.queryNewCommentId(); 57 | HashOperations ops = rt.opsForHash(); 58 | List commentlist = ops.multiGet("commentHash", idlist); 59 | return commentlist; 60 | } 61 | 62 | // 检查是否存在commentHash,不存在则存储 63 | private void saveCommentIfNotExist() { 64 | if (!rt.hasKey("commentHash")) { 65 | Map map = new HashMap(); 66 | for (Comment c : cm.queryCommentList()) { 67 | map.put(c.getCommentId(), c); 68 | } 69 | rt.opsForHash().putAll("commentHash", map); 70 | } 71 | } 72 | 73 | @Override 74 | public void deleteCommentByIdByUser(Integer commentId, String username) throws BlogException { 75 | saveCommentIfNotExist(); 76 | // 获取comment 便于 确认用户,以及删除以articleId为键的list中的评论 77 | HashOperations ops = rt.opsForHash(); 78 | Comment comment = ops.get("commentHash", commentId); 79 | //校验用户 80 | if (comment.getUsername().equals(username)) { 81 | deleteComment(comment); 82 | } else { 83 | throw new BlogException("你不是该评论的用户,无权限删除。"); 84 | } 85 | } 86 | 87 | @Override 88 | public void deleteCommentByIdByAdmin(Integer commentId) { 89 | saveCommentIfNotExist(); 90 | // 获取comment 便于 确认用户,以及删除以articleId为键的list中的评论 91 | HashOperations ops = rt.opsForHash(); 92 | Comment comment = ops.get("commentHash", commentId); 93 | deleteComment(comment); 94 | } 95 | 96 | private void deleteComment(Comment comment) { 97 | if(comment!=null) { 98 | // 数据库删除 99 | cm.deleteCommentById(comment.getCommentId()); 100 | // redisHash删除 101 | rt.opsForHash().delete("commentHash",comment.getCommentId()); 102 | // redislist删除,因为redislist中存的comment是没有articleId,所以将其置为null 103 | Integer articleId = comment.getArticleId(); 104 | comment.setArticleId(null); 105 | rt.opsForList().remove("article" + articleId, 0, comment); 106 | } 107 | } 108 | 109 | 110 | @Override 111 | public Integer queryCommentCount() { 112 | saveCommentIfNotExist(); 113 | return rt.opsForHash().size("commentHash").intValue(); 114 | } 115 | 116 | //查找一页评论 117 | @Override 118 | public Page queryCommentPage(Integer curr) { 119 | saveCommentIfNotExist(); 120 | HashOperations ops=rt.opsForHash(); 121 | Integer total = ops.size("commentHash").intValue(); 122 | Page page = new Page(); 123 | //每页8条评论 124 | page.setLimit(8); 125 | Map parameterMap = new HashMap(); 126 | //装配查询参数 127 | parameterMap.put("start", (curr-1)*page.getLimit()); 128 | parameterMap.put("limit", page.getLimit()); 129 | //获取一页Id 130 | List idlist = cm.queryPageCommentIdList(parameterMap); 131 | List commentList=ops.multiGet("commentHash", idlist); 132 | //装配参数 133 | page.setCurr(curr); 134 | page.setList(commentList); 135 | page.setTotal(total); 136 | return page; 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/LinkServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.data.redis.core.HashOperations; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.stereotype.Service; 13 | 14 | import com.frozen.myblog.mapper.LinkMapper; 15 | import com.frozen.myblog.pojo.Link; 16 | import com.frozen.myblog.service.LinkService; 17 | 18 | @Service() 19 | public class LinkServiceImpl implements LinkService { 20 | @Autowired 21 | private LinkMapper lm; 22 | @Resource(name="redisTemplate") 23 | private RedisTemplate rt; 24 | 25 | @Override 26 | public List queryLink() { 27 | saveLinkIfNotExist(); 28 | HashOperations ops = rt.opsForHash(); 29 | List linkList = ops.values("linkHash"); 30 | return linkList; 31 | } 32 | 33 | @Override 34 | public void editLink(Link link) { 35 | lm.updateLink(link); 36 | if (rt.opsForHash().hasKey("linkHash", link.getLinkId())) { 37 | rt.opsForHash().put("linkHash", link.getLinkId(), link); 38 | } 39 | 40 | } 41 | 42 | @Override 43 | public void deleteLink(Integer linkId) { 44 | lm.deleteLinkById(linkId); 45 | if (rt.opsForHash().hasKey("linkHash", linkId)) { 46 | rt.opsForHash().delete("linkHash", linkId); 47 | } 48 | } 49 | 50 | @Override 51 | public void addLink(Link link) { 52 | saveLinkIfNotExist(); 53 | lm.addLink(link); 54 | rt.opsForHash().put("linkHash", link.getLinkId(), link); 55 | ; 56 | 57 | } 58 | 59 | // 检查是否存在linkHash,不存在则存储 60 | private void saveLinkIfNotExist() { 61 | if (!rt.hasKey("linkHash")) { 62 | Map map = new HashMap(); 63 | for (Link l : lm.queryLinkList()) { 64 | map.put(l.getLinkId(), l); 65 | } 66 | rt.opsForHash().putAll("linkHash", map); 67 | } 68 | } 69 | 70 | @Override 71 | public Integer queryLinkCount() { 72 | saveLinkIfNotExist(); 73 | return rt.opsForHash().size("linkHash").intValue(); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/MailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | 7 | import javax.annotation.Resource; 8 | import javax.mail.Authenticator; 9 | import javax.mail.Message.RecipientType; 10 | import javax.mail.MessagingException; 11 | import javax.mail.PasswordAuthentication; 12 | import javax.mail.Session; 13 | import javax.mail.Transport; 14 | import javax.mail.internet.InternetAddress; 15 | import javax.mail.internet.MimeMessage; 16 | 17 | import org.springframework.data.redis.core.StringRedisTemplate; 18 | import org.springframework.stereotype.Service; 19 | 20 | import com.frozen.myblog.pojo.MailPojo; 21 | import com.frozen.myblog.service.MailService; 22 | 23 | @Service 24 | public class MailServiceImpl implements MailService { 25 | private Properties props; 26 | @Resource(name="incrmentRedisTemplate") 27 | private StringRedisTemplate rt; 28 | public MailServiceImpl() { 29 | // 初始化 30 | props = new Properties(); 31 | InputStream inputStream = MailServiceImpl.class.getClassLoader().getResourceAsStream("mail.properties"); 32 | try { 33 | props.load(inputStream); 34 | } catch (IOException e) { 35 | e.printStackTrace(); 36 | } 37 | } 38 | 39 | @Override 40 | public void sendMail(MailPojo mail) throws MessagingException { 41 | // 邮箱认证 42 | Authenticator auth = new Authenticator() { 43 | @Override 44 | protected PasswordAuthentication getPasswordAuthentication() { 45 | return new PasswordAuthentication(props.getProperty("mail.from"), props.getProperty("mail.password")); 46 | } 47 | }; 48 | Session mailSession = Session.getInstance(props, auth); 49 | MimeMessage message = new MimeMessage(mailSession); 50 | // 设置邮件发信人 51 | message.setFrom(new InternetAddress(props.getProperty("mail.from"))); 52 | // 设置邮件标题 53 | message.setSubject("Blog有人发消息了!!!"); 54 | // 设置邮件内容 55 | message.setContent(mail.getMailTitle() + "
" + mail.getMailContent(), "text/html;charset=utf-8"); 56 | // 设置邮件收信人,以及发送方式:正常发送 57 | message.addRecipient(RecipientType.TO, new InternetAddress(props.getProperty("mail.to"))); 58 | // 发送 59 | Transport.send(message); 60 | // redis操作 61 | //如果 key不存在,那么 key 的值会先被初始化为 0 ,然后再执行 INCR 操作,所以直接自增操作即可 62 | rt.opsForValue().increment("mailNum", 1); 63 | } 64 | 65 | @Override 66 | public Integer getMailNum() { 67 | //将mailNum取出' 68 | String str = rt.opsForValue().get("mailNum"); 69 | if(str==null) return 0; 70 | Integer i =Integer.parseInt(str); 71 | return i; 72 | } 73 | 74 | @Override 75 | public void setMailNumZero() { 76 | //删除mailNum 77 | rt.delete("mailNum"); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/service/implement/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.service.implement; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.data.redis.core.RedisTemplate; 9 | import org.springframework.data.redis.core.ValueOperations; 10 | import org.springframework.stereotype.Service; 11 | 12 | import com.frozen.myblog.mapper.UserMapper; 13 | import com.frozen.myblog.pojo.User; 14 | import com.frozen.myblog.service.UserService; 15 | import com.frozen.myblog.util.BlogException; 16 | import com.frozen.myblog.util.MyUtils; 17 | 18 | @Service 19 | public class UserServiceImpl implements UserService { 20 | @Autowired 21 | private UserMapper um; 22 | @Resource(name="redisTemplate") 23 | private RedisTemplate rt; 24 | 25 | @Override 26 | public User login(User user) throws BlogException { 27 | // 先从redis中查看该用户是否存在 28 | ValueOperations ops = rt.opsForValue(); 29 | User t_user = (User) ops.get("username:" + user.getUsername()); 30 | // 不存在,从数据库中查找,再存入redis 31 | if (t_user == null) { 32 | t_user = um.queryUserByUsername(user.getUsername()); 33 | } 34 | // 找不到该用户 35 | if (t_user == null) { 36 | throw new BlogException("用户名不存在"); 37 | } else { 38 | // 无论t_user是在redis中还是数据库中查到,覆盖过期时间,10天过期。 39 | ops.set("username:" + t_user.getUsername(), t_user, 10, TimeUnit.DAYS); 40 | // 校验密码 41 | if (t_user.getPassword().equals(user.getPassword())) { 42 | return t_user; 43 | } else { 44 | throw new BlogException("用户名或密码错误"); 45 | } 46 | } 47 | } 48 | 49 | @Override 50 | public void register(User user) throws BlogException { 51 | boolean isExit = existUsername(user.getUsername()); 52 | if (isExit) { 53 | // 若数据库中已存在该用户名,抛出异常 54 | throw new BlogException("用户名已存在"); 55 | } 56 | // 无该用户,正常注册 57 | try { 58 | um.saveUser(user); 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | throw new BlogException("注册异常"); 62 | } 63 | } 64 | 65 | // 校验用户名是否存在 66 | @Override 67 | public boolean existUsername(String username) throws BlogException { 68 | if (MyUtils.checkempty(username)) { 69 | throw new BlogException("用户名不能为空"); 70 | } else { 71 | // 先从redis中查看用户名是否存在 72 | ValueOperations ops = rt.opsForValue(); 73 | User user = (User) ops.get("username:" + username); 74 | if (user != null) 75 | return true; 76 | // 不存在,再去查找数据库 77 | Integer i = um.query1ByUsername(username); 78 | // 若ID不存在,用户不存在,返回false 79 | if (i == null) 80 | return false; 81 | // 否则 返回true 82 | return true; 83 | } 84 | } 85 | 86 | @Override 87 | public User addVisitor(String username) { 88 | User user = new User(); 89 | user.setUsername(username); 90 | // 确认该游客名是否存在,存在就使用,不存在则创建 91 | Integer i=um.query1ByUsername(username); 92 | if (i == null) 93 | um.saveVisitor(username); 94 | return user; 95 | } 96 | //查找用户总数量 97 | @Override 98 | public Integer queryUserCount() { 99 | return um.queryCount(); 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/Base64Utils.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.util.Base64; 5 | 6 | public class Base64Utils { 7 | public static String encode(String str) { 8 | try { 9 | return Base64.getEncoder().encodeToString(str.getBytes("utf-8")); 10 | } catch (UnsupportedEncodingException e) { 11 | throw new RuntimeException(e); 12 | } 13 | } 14 | 15 | public static String decode(String b64) { 16 | try { 17 | return new String(Base64.getDecoder().decode(b64),"utf-8"); 18 | } catch (UnsupportedEncodingException e) { 19 | throw new RuntimeException(e); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/BlogException.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | public class BlogException extends Exception { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public BlogException() { 8 | super(); 9 | }; 10 | 11 | public BlogException(String mes) { 12 | super(mes); 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/ImgFontByte.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | import java.awt.Font; 4 | import java.io.ByteArrayInputStream; 5 | 6 | public class ImgFontByte { 7 | public Font getFont(int fontHeight) { 8 | try { 9 | Font baseFont = Font.createFont(Font.ITALIC, new ByteArrayInputStream(hex2byte(getFontByteStr()))); 10 | return baseFont.deriveFont(Font.PLAIN, fontHeight); 11 | } catch (Exception e) { 12 | return new Font("Consola", Font.PLAIN, fontHeight); 13 | } 14 | } 15 | 16 | private byte[] hex2byte(String str) { 17 | if (str == null) 18 | return null; 19 | str = str.trim(); 20 | int len = str.length(); 21 | if (len == 0 || len % 2 == 1) 22 | return null; 23 | byte[] b = new byte[len / 2]; 24 | try { 25 | for (int i = 0; i < str.length(); i += 2) { 26 | b[i / 2] = (byte) Integer.decode("0x" + str.substring(i, i + 2)).intValue(); 27 | } 28 | return b; 29 | } catch (Exception e) { 30 | return null; 31 | } 32 | } 33 | 34 | /** 35 | * ttf字体文件的十六进制字符串 36 | * 37 | * @return 38 | */ 39 | private String getFontByteStr() { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/MyUtils.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | public class MyUtils { 4 | // 校验用户名 5 | public static void ckeckUsername(String username) throws BlogException { 6 | if (checkempty(username)) { 7 | throw new BlogException("用户名不能为空"); 8 | } 9 | if (username.length() < 3 || username.length() > 8) { 10 | throw new BlogException("用户名长度在3-8位之间"); 11 | } 12 | } 13 | 14 | // 校验密码 15 | public static void ckeckpassword(String password) throws BlogException { 16 | if (checkempty(password)) { 17 | throw new BlogException("密码不能为空"); 18 | } 19 | if (password.length() < 6 || password.length() > 12) { 20 | throw new BlogException("密码长度在6-12位之间"); 21 | } 22 | } 23 | 24 | // 校验字符串是否为空 25 | public static boolean checkempty(String str) { 26 | // 字符串为null或去前后空格为空 返回true 27 | if (str == null || str.trim().equals("")) { 28 | return true; 29 | } 30 | return false; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/Page.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | import java.util.List; 4 | 5 | public class Page { 6 | // 当前页码 7 | private int curr; 8 | // 数据总条数 9 | private int total; 10 | // 每页数据条数,默认5 11 | private int limit = 5; 12 | // 总页数 13 | private int pageTotal; 14 | //数据 15 | private List list ; 16 | public Page() { 17 | 18 | } 19 | 20 | public int getCurr() { 21 | return curr; 22 | } 23 | 24 | public void setCurr(int curr) { 25 | this.curr = curr; 26 | } 27 | 28 | public int getTotal() { 29 | return total; 30 | } 31 | 32 | public void setTotal(int total) { 33 | this.total = total; 34 | } 35 | 36 | public int getLimit() { 37 | return limit; 38 | } 39 | 40 | public void setLimit(int limit) { 41 | this.limit = limit; 42 | } 43 | 44 | public int getPageTotal() { 45 | return pageTotal; 46 | } 47 | 48 | public void setPageTotal(int pageTotal) { 49 | this.pageTotal = pageTotal; 50 | } 51 | 52 | // 计算总页数 53 | public void calculatePageTotal() { 54 | this.pageTotal = (this.total % this.limit == 0) ? this.total / this.limit : this.total / this.limit + 1; 55 | } 56 | 57 | public List getList() { 58 | return list; 59 | } 60 | 61 | public void setList(List list) { 62 | this.list = list; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "Page [curr=" + curr + ", total=" + total + ", limit=" + limit + ", pageTotal=" + pageTotal + ", list=" 68 | + list + "]"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/Uploader.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | 4 | 5 | import java.io.File; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | import java.util.UUID; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | import org.springframework.web.multipart.MultipartFile; 13 | /** 14 | * 图片上传工具类 15 | * 16 | */ 17 | public class Uploader { 18 | // 输出文件地址 19 | private String url = ""; 20 | // 状态 21 | private String state = ""; 22 | // 保存路径 23 | private String savePath = "static/upload"; 24 | //项目真实路径 25 | private String realPath; 26 | //项目根路径 27 | private String contextPath; 28 | //上传文件 29 | private MultipartFile file; 30 | //文件类型 31 | private String fileType; 32 | // 文件允许格式 33 | private String[] allowFiles = {".gif", ".png", ".jpg", ".jpeg", ".bmp"}; 34 | 35 | public Uploader() { 36 | 37 | } 38 | 39 | public Uploader(HttpServletRequest req) { 40 | // 获取项目的根路径和真实路径 41 | this.contextPath = req.getContextPath(); 42 | this.realPath = req.getSession().getServletContext().getRealPath("/"); 43 | } 44 | 45 | public void upload() { 46 | 47 | try { 48 | if(this.contextPath ==null||this.realPath ==null) { 49 | throw new BlogException("上传前需要设置项目路径和真实路径"); 50 | } 51 | //检查文件类型 52 | String originalName = this.file.getOriginalFilename(); 53 | this.fileType = originalName.substring(originalName.lastIndexOf(".")); 54 | this.checkFileType(); 55 | //得到子文件夹路径 56 | String path = this.getFolder(this.savePath); 57 | //存储的随机文件名 58 | String newFileName = UUID.randomUUID()+this.fileType; 59 | file.transferTo(new File(this.realPath+"/"+path+"/"+newFileName)); 60 | this.url = this.contextPath+"/"+path+"/"+newFileName; 61 | this.state="success"; 62 | } catch (Exception e) { 63 | this.state="error"; 64 | e.printStackTrace(); 65 | } 66 | } 67 | //文件类型检测 68 | private void checkFileType() throws BlogException { 69 | for(String type:allowFiles) { 70 | //若文件符合,返回 71 | if(type.equalsIgnoreCase(this.fileType)) 72 | return ; 73 | } 74 | //不符合,抛出异常 75 | throw new BlogException("文件类型不符合要求"); 76 | } 77 | 78 | //创建年月日文件夹 79 | private String getFolder(String path) { 80 | SimpleDateFormat format = new SimpleDateFormat("yyMMdd"); 81 | path +="/"+format.format(new Date()); 82 | File dir = new File(this.realPath+"/"+path); 83 | //若文件夹不存在,则创建 84 | if(!dir.exists()) { 85 | dir.mkdirs(); 86 | } 87 | return path; 88 | } 89 | 90 | public String getContextPath() { 91 | return contextPath; 92 | } 93 | 94 | public void setContextPath(String contextPath) { 95 | this.contextPath = contextPath; 96 | } 97 | 98 | public String getUrl() { 99 | return url; 100 | } 101 | 102 | 103 | public String getState() { 104 | return state; 105 | } 106 | 107 | public String getSavePath() { 108 | return savePath; 109 | } 110 | 111 | public void setSavePath(String savePath) { 112 | this.savePath = savePath; 113 | } 114 | 115 | public MultipartFile getFile() { 116 | return file; 117 | } 118 | 119 | public void setFile(MultipartFile file) { 120 | this.file = file; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/frozen/myblog/util/VerifyCode.java: -------------------------------------------------------------------------------- 1 | package com.frozen.myblog.util; 2 | 3 | import java.awt.Color; 4 | 5 | import java.awt.Font; 6 | import java.awt.Graphics2D; 7 | import java.awt.image.BufferedImage; 8 | import java.io.File; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | import java.io.OutputStream; 12 | import java.util.Random; 13 | 14 | import javax.imageio.ImageIO; 15 | import javax.servlet.http.HttpSession; 16 | 17 | /** 18 | * 验证码生成器 19 | * 验证码源地址:https://segmentfault.com/a/1190000006137703 20 | */ 21 | public class VerifyCode { 22 | // 图片的宽度。 23 | private int width = 100; 24 | // 图片的高度。 25 | private int height = 20; 26 | // 验证码字符个数 27 | private int codeCount = 4; 28 | // 验证码干扰线数 29 | private int lineCount = 60; 30 | // 验证码 31 | private static String code = null; 32 | // 验证码图片Buffer 33 | private BufferedImage buffImg = null; 34 | 35 | private char[] codeSequence = {'0','1', '2', '3', '4', '5', '6', '7', '8', '9' }; 36 | 37 | public VerifyCode() { 38 | this.createCode(); 39 | } 40 | 41 | /** 42 | * 43 | * @param width 44 | * 图片宽 45 | * @param height 46 | * 图片高 47 | */ 48 | public VerifyCode(int width, int height) { 49 | this.width = width; 50 | this.height = height; 51 | this.createCode(); 52 | } 53 | 54 | /** 55 | * 56 | * @param width 57 | * 图片宽 58 | * @param height 59 | * 图片高 60 | * @param codeCount 61 | * 字符个数 62 | * @param lineCount 63 | * 干扰线条数 64 | */ 65 | public VerifyCode(int width, int height, int codeCount, int lineCount) { 66 | this.width = width; 67 | this.height = height; 68 | this.codeCount = codeCount; 69 | this.lineCount = lineCount; 70 | this.createCode(); 71 | } 72 | 73 | public void createCode() { 74 | int x = 0, fontHeight = 0, codeY = 0; 75 | int red = 0, green = 0, blue = 0; 76 | 77 | x = width / (codeCount + 1);// 每个字符的宽度 78 | fontHeight = height - 2;// 字体的高度 79 | codeY = height - 3; 80 | 81 | // 图像buffer 82 | buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 83 | Graphics2D g = buffImg.createGraphics(); 84 | // 生成随机数 85 | Random random = new Random(); 86 | // 将图像填充为白色 87 | g.setColor(Color.WHITE); 88 | g.fillRect(0, 0, width, height); 89 | // 创建字体 90 | ImgFontByte imgFont = new ImgFontByte(); 91 | Font font = imgFont.getFont(fontHeight); 92 | g.setFont(font); 93 | for (int i = 0; i < lineCount; i++) { 94 | int xs = random.nextInt(width); 95 | int ys = random.nextInt(height); 96 | int xe = xs + random.nextInt(width / 8); 97 | int ye = ys + random.nextInt(height / 8); 98 | red = random.nextInt(255); 99 | green = random.nextInt(255); 100 | blue = random.nextInt(255); 101 | g.setColor(new Color(red, green, blue)); 102 | g.drawLine(xs, ys, xe, ye); 103 | } 104 | // randomCode记录随机产生的验证码 105 | StringBuffer randomCode = new StringBuffer(); 106 | // 随机产生codeCount个字符的验证码。 107 | for (int i = 0; i < codeCount; i++) { 108 | String strRand = String.valueOf(codeSequence[random.nextInt(codeSequence.length)]); 109 | // 产生随机的颜色值,让输出的每个字符的颜色值都将不同。 110 | red = random.nextInt(255); 111 | green = random.nextInt(255); 112 | blue = random.nextInt(255); 113 | g.setColor(new Color(red, green, blue)); 114 | g.drawString(strRand, (i + 1) * x, codeY); 115 | // 将产生的随机数组合在一起。 116 | randomCode.append(strRand); 117 | } 118 | // 保存验证码。 119 | code = randomCode.toString(); 120 | } 121 | 122 | public void write(String path, String fileName) throws IOException { 123 | File folder = new File(path); 124 | if (!folder.exists()) { 125 | folder.mkdirs(); 126 | } 127 | OutputStream sos = new FileOutputStream(path + fileName); 128 | this.write(sos); 129 | } 130 | 131 | public void write(OutputStream sos) throws IOException { 132 | ImageIO.write(buffImg, "png", sos); 133 | sos.close(); 134 | } 135 | 136 | public BufferedImage getBuffImg() { 137 | return buffImg; 138 | } 139 | 140 | public String getCode() { 141 | return code; 142 | } 143 | 144 | public static boolean confirmVerify(String verify,HttpSession session) { 145 | //校验验证码 146 | String c = (String) session.getAttribute("code"); 147 | if(verify!=null&&verify.equals(c)) { 148 | return true; 149 | } 150 | return false; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/blog?characterEncoding=utf-8 3 | jdbc.username=root 4 | jdbc.password=123 5 | #redis configuration 6 | redis.hostname=127.0.0.1 7 | redis.port=6379 -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Configure logging for testing: optionally with log file 2 | log4j.rootLogger=DEBUG, stdout 3 | # log4j.rootLogger=WARN, stdout, logfile 4 | 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n 8 | 9 | #log4j.appender.logfile=org.apache.log4j.FileAppender 10 | #log4j.appender.logfile.File=target/spring.log 11 | #log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 12 | #log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n -------------------------------------------------------------------------------- /src/main/resources/mail.properties: -------------------------------------------------------------------------------- 1 | # \u53d1\u9001\u8005\u90ae\u7bb1\u4fe1\u606f 2 | mail.transport.protocol = smtp 3 | mail.smtp.auth = true 4 | mail.host = smtp.qq.com 5 | mail.from = 6 | #\u6388\u6743\u7801 7 | mail.password = 8 | # \u6536\u4ef6\u4eba\u90ae\u7bb1 9 | mail.to = 10 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/spring/applicationContext-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/spring/applicationContext-redis.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/resources/spring/applicationContext-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/spring/applicationContext-trans.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/resources/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/comment.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 评论管理 14 | 15 | 16 | 17 | 18 | 19 | <%@include file="head.jsp" %> 20 | 21 |
22 |
23 | 24 | 评论列表 26 | 27 |
28 | 29 | 30 | 31 |
32 | Responsive image 34 |
35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 |

用户名:${comment.username }

43 |

${comment.commentContent }

44 | 45 |
46 | 49 |
50 |
51 |
52 | [] 53 |
54 |
55 |
56 | 57 |
58 |
59 |
60 |
61 |
62 |
63 | 64 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 10 | 11 | 错误提示 12 | 13 | 14 | 15 | 16 | 17 | 18 | <%@include file="head.jsp"%> 19 |
20 |
21 | 22 | 信息提示 24 | 25 |
27 | 28 | 29 | 30 |

出错了!!!

31 |
32 | 33 |

${param.msg }

34 |
35 |
36 |
37 |
38 |
39 | 40 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/head.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 |
4 |
5 | 43 | 44 | 55 | 56 | 69 |
70 |
71 | 87 | 88 | 92 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 后台首页 12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | <%@include file="head.jsp" %> 24 | 25 |
26 |
27 | 快速入口 28 |
29 |

欢迎回来,管理员!!

30 |
31 | 71 |
72 |
73 |
74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 成功提示 13 | 14 | 15 | 16 | 17 | 18 | 19 | <%@include file="head.jsp"%> 20 |
21 |
22 | 23 | 信息提示 25 | 26 |
28 | 29 | 30 | 31 |

操作成功!!!

32 |
33 | 34 |

${param.msg }

35 |
36 |
37 |
38 |
39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 错误提示 16 | 17 | 18 | <%@include file="head.jsp" %> 19 |
20 |
21 | 22 |
23 |
24 | 信息提示 25 |
26 |
27 | 28 | 29 | 30 |

出错了!!!

31 |
32 | 33 |

${param.msg }

34 |
35 |
36 |
37 |
38 | 39 | 40 | <%@include file="sidebar.jsp" %> 41 | 42 |
43 |
44 | <%@include file="footer.jsp" %> 45 | 46 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | login 13 | 19 | 20 | 21 | 22 |
23 |
24 |
25 | 28 | 29 | ${msg } 30 | 31 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 39 | 40 |
41 |
42 | 45 |
46 | 47 |
48 | 49 |
50 |
51 |
52 | <%@include file="footer.jsp" %> 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/personalcomment.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 个人评论 15 | 16 | 17 | <%@include file="head.jsp" %> 18 |
19 |
20 | 21 |
22 |
23 | 个人评论 24 |
25 | 26 | 27 | 28 |
29 | Responsive image 31 |
32 | 33 |
34 | 35 | 36 |
37 |

${comment.commentContent }

38 |
39 | 40 |
41 |
42 |
43 | [] 44 |
45 |
46 |
47 |
48 |
49 | 70 | 71 | 72 | <%@include file="sidebar.jsp" %> 73 | 74 |
75 |
76 | <%@include file="footer.jsp" %> 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | 18 | 20 | 22 | 24 | 25 | register 26 | 31 | 101 | 102 | 103 | 104 |
105 |
106 |
107 | 110 | 111 | ${msg } 112 | 113 |
115 |
116 | 119 |
120 |
121 | 124 |
125 |
126 | 127 | 换一张 129 | 131 |
132 | 133 |
134 | 135 | 136 | 137 |
138 |
139 |
140 | <%@include file="footer.jsp"%> 141 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/sidebar.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 |
5 | 6 |
7 |
8 | 9 | 最新评论 10 |
11 |
    12 |
13 |
14 | 15 | 16 |
17 |
18 | 19 | 友情链接 20 |
21 | 23 |
24 | 25 |
26 | 27 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 成功提示 17 | 18 | 19 | <%@include file="head.jsp" %> 20 |
21 |
22 | 23 |
24 |
25 | 信息提示 26 |
27 |
28 | 29 | 30 | 31 |

操作成功!!!

32 |
33 | 34 |

${param.msg }

35 |
36 |
37 |
38 |
39 | 40 | 41 | <%@include file="sidebar.jsp" %> 42 | 43 |
44 |
45 | <%@include file="footer.jsp" %> 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | blog 4 | 5 | HttpPutFormContentFilter 6 | org.springframework.web.filter.HttpPutFormContentFilter 7 | 8 | 9 | CharacterEncodingFilter 10 | org.springframework.web.filter.CharacterEncodingFilter 11 | 12 | encoding 13 | UTF-8 14 | 15 | 16 | 17 | HiddenHttpMethodFilter 18 | org.springframework.web.filter.HiddenHttpMethodFilter 19 | 20 | 21 | HttpPutFormContentFilter 22 | /* 23 | 24 | 25 | CharacterEncodingFilter 26 | /* 27 | 28 | 29 | HiddenHttpMethodFilter 30 | /* 31 | 32 | 33 | contextConfigLocation 34 | classpath:spring/applicationContext-*.xml 35 | 36 | 37 | org.springframework.web.context.ContextLoaderListener 38 | 39 | 40 | springDispatcherServlet 41 | org.springframework.web.servlet.DispatcherServlet 42 | 43 | contextConfigLocation 44 | classpath:spring/springmvc.xml 45 | 46 | 1 47 | 48 | 49 | springDispatcherServlet 50 | / 51 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/static/css/main.css: -------------------------------------------------------------------------------- 1 | span a { 2 | color: white; 3 | } 4 | 5 | textarea { 6 | resize: none; 7 | } 8 | 9 | h3 { 10 | color: #444444; 11 | } 12 | 13 | .item h2 { 14 | background-image: -webkit-linear-gradient(left, blue, #66ffff 10%, #cc00ff 20%, #CC00CC 15 | 30%, #CCCCFF 40%, #00FFFF 50%, #CCCCFF 60%, #CC00CC 70%, #CC00FF 80%, 16 | #66FFFF 90%, blue 100%); 17 | -webkit-text-fill-color: transparent; /* 将字体设置成透明色 */ 18 | -webkit-background-clip: text; /* 裁剪背景图,使文字作为裁剪区域向外裁剪 */ 19 | -webkit-background-size: 200% 100%; 20 | -webkit-animation: masked-animation 4s linear infinite; 21 | font-size: 25px; 22 | } 23 | 24 | img { 25 | margin: 0 auto; 26 | } 27 | 28 | body { 29 | padding-top: 50px; 30 | padding-bottom: 40px; 31 | } 32 | 33 | .item p { 34 | float: right; 35 | color: transparent; 36 | background-color: blue; 37 | text-shadow: rgba(255, 255, 255, 0.5) 0 5px 6px, 38 | rgba(255, 255, 255, 0.2) 1px 3px 3px; 39 | -webkit-background-clip: text; 40 | } 41 | 42 | .data_list { 43 | border: 1px solid #E5E5E5; 44 | padding: 12px; 45 | background-color: #FDFDFD; 46 | margin-top: 0px; 47 | margin-bottom: 10px; 48 | } 49 | 50 | .data_list_title { 51 | font-size: 15px; 52 | font-weight: bold; 53 | border-bottom: 1px solid #E5E5E5; 54 | padding-bottom: 10px; 55 | padding-top: 5px; 56 | } 57 | 58 | .info { 59 | color: #888888; 60 | line-height: 10px; 61 | float: right; 62 | font-size: 11px; 63 | } 64 | 65 | .data { 66 | color: #666666; 67 | font-size: 15px; 68 | word-wrap: break-word; 69 | word-break: break-all; 70 | overflow: hidden; 71 | } 72 | 73 | .rightlocation { 74 | float: right; 75 | } 76 | 77 | .clearfloat { 78 | clear: both; 79 | } 80 | 81 | .boundary { 82 | width: 100%; 83 | height: 1px; 84 | margin: 0px auto; 85 | padding: 0px; 86 | background-color: #5bc0de; 87 | overflow: hidden; 88 | } 89 | 90 | .icon { 91 | margin: 10px 0px 10px 0px; 92 | } 93 | 94 | 95 | .message { 96 | color: rgb(114, 130, 85); 97 | font-size: x-large; 98 | } -------------------------------------------------------------------------------- /src/main/webapp/static/css/register&login.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-repeat: no-repeat; 3 | background-attachment: fixed; 4 | background-position: center; 5 | background-size: cover; 6 | -webkit-background-size: cover; 7 | padding-bottom: 40px; 8 | } 9 | 10 | label { 11 | color: #2F21D4; 12 | } 13 | 14 | #password{ 15 | ime-mode:disabled; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/webapp/static/img/admin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/admin.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/articlephoto/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/articlephoto/0.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/articlephoto/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/articlephoto/1.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/articlephoto/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/articlephoto/2.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/articlephoto/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/articlephoto/3.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/articlephoto/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/articlephoto/4.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/comment.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/emptyarticle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/emptyarticle.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/emptycomment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/emptycomment.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/error.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/loginbackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/loginbackground.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/profilephoto/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/profilephoto/0.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/profilephoto/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/profilephoto/1.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/profilephoto/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/profilephoto/2.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/profilephoto/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/profilephoto/3.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/profilephoto/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/profilephoto/4.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/registerbackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/registerbackground.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/img/success.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/img/success.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/js/register&login.js: -------------------------------------------------------------------------------- 1 | function removeblank(obj){ 2 | obj.value=obj.value.replace(/\s+/g,''); 3 | } 4 | -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/font/iconfont.eot -------------------------------------------------------------------------------- /src/main/webapp/static/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /src/main/webapp/static/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/font/iconfont.woff -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/0.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/1.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/10.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/11.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/12.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/13.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/14.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/15.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/16.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/17.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/18.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/19.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/2.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/20.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/21.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/22.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/23.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/24.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/25.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/26.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/27.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/28.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/29.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/3.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/30.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/31.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/32.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/33.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/34.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/35.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/36.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/37.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/38.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/39.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/4.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/40.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/41.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/42.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/43.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/44.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/45.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/46.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/47.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/48.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/49.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/5.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/50.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/51.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/52.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/53.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/54.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/55.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/56.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/57.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/58.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/59.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/6.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/60.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/61.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/62.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/63.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/64.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/65.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/66.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/67.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/68.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/69.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/7.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/70.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/71.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/8.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/layui/images/face/9.gif -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/carousel.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
    ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/laypage.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/rate.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='
    ",u=1;u<=i.length;u++){var r='
  • ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'
  • ":n+=r}n+="
"+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)}); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/tree.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
    '),s=o(["
  • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
  • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
    '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})}); -------------------------------------------------------------------------------- /src/main/webapp/static/layui/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(t){"use strict";var e=layui.$,i={fixbar:function(t){var i,a,n="layui-fixbar",r="layui-fixbar-top",o=e(document),l=e("body");t=e.extend({showHeight:200},t),t.bar1=t.bar1===!0?"":t.bar1,t.bar2=t.bar2===!0?"":t.bar2,t.bgcolor=t.bgcolor?"background-color:"+t.bgcolor:"";var c=[t.bar1,t.bar2,""],g=e(['
      ',t.bar1?'
    • '+c[0]+"
    • ":"",t.bar2?'
    • '+c[1]+"
    • ":"",'
    • '+c[2]+"
    • ","
    "].join("")),s=g.find("."+r),u=function(){var e=o.scrollTop();e>=t.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};e("."+n)[0]||("object"==typeof t.css&&g.css(t.css),l.append(g),u(),g.find("li").on("click",function(){var i=e(this),a=i.attr("lay-type");"top"===a&&e("html,body").animate({scrollTop:0},200),t.click&&t.click.call(this,a)}),o.on("scroll",function(){clearTimeout(a),a=setTimeout(function(){u()},100)}))},countdown:function(t,e,i){var a=this,n="function"==typeof e,r=new Date(t).getTime(),o=new Date(!e||n?(new Date).getTime():e).getTime(),l=r-o,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];n&&(i=e);var g=setTimeout(function(){a.countdown(t,o+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],e,g),l<=0&&clearTimeout(g),g},timeAgo:function(t,e){var i=this,a=[[],[]],n=(new Date).getTime()-new Date(t).getTime();return n>6912e5?(n=new Date(t),a[0][0]=i.digit(n.getFullYear(),4),a[0][1]=i.digit(n.getMonth()+1),a[0][2]=i.digit(n.getDate()),e||(a[1][0]=i.digit(n.getHours()),a[1][1]=i.digit(n.getMinutes()),a[1][2]=i.digit(n.getSeconds())),a[0].join("-")+" "+a[1].join(":")):n>=864e5?(n/1e3/60/60/24|0)+"天前":n>=36e5?(n/1e3/60/60|0)+"小时前":n>=12e4?(n/1e3/60|0)+"分钟前":n<0?"未来":"刚刚"},digit:function(t,e){var i="";t=String(t),e=e||2;for(var a=t.length;a/g,">").replace(/'/g,"'").replace(/"/g,""")}};!function(t,e,i){"$:nomunge";function a(){n=e[l](function(){r.each(function(){var e=t(this),i=e.width(),a=e.height(),n=t.data(this,g);(i!==n.w||a!==n.h)&&e.trigger(c,[n.w=i,n.h=a])}),a()},o[s])}var n,r=t([]),o=t.resize=t.extend(t.resize,{}),l="setTimeout",c="resize",g=c+"-special-event",s="delay",u="throttleWindow";o[s]=250,o[u]=!0,t.event.special[c]={setup:function(){if(!o[u]&&this[l])return!1;var e=t(this);r=r.add(e),t.data(this,g,{w:e.width(),h:e.height()}),1===r.length&&a()},teardown:function(){if(!o[u]&&this[l])return!1;var e=t(this);r=r.not(e),e.removeData(g),r.length||clearTimeout(n)},add:function(e){function a(e,a,r){var o=t(this),l=t.data(this,g)||{};l.w=a!==i?a:o.width(),l.h=r!==i?r:o.height(),n.apply(this,arguments)}if(!o[u]&&this[l])return!1;var n;return t.isFunction(e)?(n=e,a):(n=e.handler,void(e.handler=a))}}}(e,window),t("util",i)}); -------------------------------------------------------------------------------- /src/main/webapp/static/validator/dist/css/bootstrapValidator.css: -------------------------------------------------------------------------------- 1 | /** 2 | * BootstrapValidator (http://bootstrapvalidator.com) 3 | * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3 4 | * 5 | * @author http://twitter.com/nghuuphuoc 6 | * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc 7 | * @license Commercial: http://bootstrapvalidator.com/license/ 8 | * Non-commercial: http://creativecommons.org/licenses/by-nc-nd/3.0/ 9 | */ 10 | 11 | .bv-form .help-block { 12 | margin-bottom: 0; 13 | } 14 | .bv-form .tooltip-inner { 15 | text-align: left; 16 | } 17 | .nav-tabs li.bv-tab-success > a { 18 | color: #3c763d; 19 | } 20 | .nav-tabs li.bv-tab-error > a { 21 | color: #a94442; 22 | } 23 | 24 | .bv-form .bv-icon-no-label { 25 | top: 0; 26 | } 27 | 28 | .bv-form .bv-icon-input-group { 29 | top: 0; 30 | z-index: 100; 31 | } -------------------------------------------------------------------------------- /src/main/webapp/static/validator/dist/css/bootstrapValidator.min.css: -------------------------------------------------------------------------------- 1 | .bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}.bv-form .bv-icon-no-label{top:0}.bv-form .bv-icon-input-group{top:0;z-index:100} -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/validator/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/jasmine/console.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2013 Pivotal Labs 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | function getJasmineRequireObj() { 24 | if (typeof module !== "undefined" && module.exports) { 25 | return exports; 26 | } else { 27 | window.jasmineRequire = window.jasmineRequire || {}; 28 | return window.jasmineRequire; 29 | } 30 | } 31 | 32 | getJasmineRequireObj().console = function(jRequire, j$) { 33 | j$.ConsoleReporter = jRequire.ConsoleReporter(); 34 | }; 35 | 36 | getJasmineRequireObj().ConsoleReporter = function() { 37 | 38 | var noopTimer = { 39 | start: function(){}, 40 | elapsed: function(){ return 0; } 41 | }; 42 | 43 | function ConsoleReporter(options) { 44 | var print = options.print, 45 | showColors = options.showColors || false, 46 | onComplete = options.onComplete || function() {}, 47 | timer = options.timer || noopTimer, 48 | specCount, 49 | failureCount, 50 | failedSpecs = [], 51 | pendingCount, 52 | ansi = { 53 | green: '\x1B[32m', 54 | red: '\x1B[31m', 55 | yellow: '\x1B[33m', 56 | none: '\x1B[0m' 57 | }; 58 | 59 | this.jasmineStarted = function() { 60 | specCount = 0; 61 | failureCount = 0; 62 | pendingCount = 0; 63 | print("Started"); 64 | printNewline(); 65 | timer.start(); 66 | }; 67 | 68 | this.jasmineDone = function() { 69 | printNewline(); 70 | for (var i = 0; i < failedSpecs.length; i++) { 71 | specFailureDetails(failedSpecs[i]); 72 | } 73 | 74 | printNewline(); 75 | var specCounts = specCount + " " + plural("spec", specCount) + ", " + 76 | failureCount + " " + plural("failure", failureCount); 77 | 78 | if (pendingCount) { 79 | specCounts += ", " + pendingCount + " pending " + plural("spec", pendingCount); 80 | } 81 | 82 | print(specCounts); 83 | 84 | printNewline(); 85 | var seconds = timer.elapsed() / 1000; 86 | print("Finished in " + seconds + " " + plural("second", seconds)); 87 | 88 | printNewline(); 89 | 90 | onComplete(failureCount === 0); 91 | }; 92 | 93 | this.specDone = function(result) { 94 | specCount++; 95 | 96 | if (result.status == "pending") { 97 | pendingCount++; 98 | print(colored("yellow", "*")); 99 | return; 100 | } 101 | 102 | if (result.status == "passed") { 103 | print(colored("green", '.')); 104 | return; 105 | } 106 | 107 | if (result.status == "failed") { 108 | failureCount++; 109 | failedSpecs.push(result); 110 | print(colored("red", 'F')); 111 | } 112 | }; 113 | 114 | return this; 115 | 116 | function printNewline() { 117 | print("\n"); 118 | } 119 | 120 | function colored(color, str) { 121 | return showColors ? (ansi[color] + str + ansi.none) : str; 122 | } 123 | 124 | function plural(str, count) { 125 | return count == 1 ? str : str + "s"; 126 | } 127 | 128 | function repeat(thing, times) { 129 | var arr = []; 130 | for (var i = 0; i < times; i++) { 131 | arr.push(thing); 132 | } 133 | return arr; 134 | } 135 | 136 | function indent(str, spaces) { 137 | var lines = (str || '').split("\n"); 138 | var newArr = []; 139 | for (var i = 0; i < lines.length; i++) { 140 | newArr.push(repeat(" ", spaces).join("") + lines[i]); 141 | } 142 | return newArr.join("\n"); 143 | } 144 | 145 | function specFailureDetails(result) { 146 | printNewline(); 147 | print(result.fullName); 148 | 149 | for (var i = 0; i < result.failedExpectations.length; i++) { 150 | var failedExpectation = result.failedExpectations[i]; 151 | printNewline(); 152 | print(indent(failedExpectation.stack, 2)); 153 | } 154 | 155 | printNewline(); 156 | } 157 | } 158 | 159 | return ConsoleReporter; 160 | }; 161 | -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/jasmine/jasmine.css: -------------------------------------------------------------------------------- 1 | body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } 2 | 3 | .html-reporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } 4 | .html-reporter a { text-decoration: none; } 5 | .html-reporter a:hover { text-decoration: underline; } 6 | .html-reporter p, .html-reporter h1, .html-reporter h2, .html-reporter h3, .html-reporter h4, .html-reporter h5, .html-reporter h6 { margin: 0; line-height: 14px; } 7 | .html-reporter .banner, .html-reporter .symbol-summary, .html-reporter .summary, .html-reporter .result-message, .html-reporter .spec .description, .html-reporter .spec-detail .description, .html-reporter .alert .bar, .html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; } 8 | .html-reporter .banner .version { margin-left: 14px; } 9 | .html-reporter #jasmine_content { position: fixed; right: 100%; } 10 | .html-reporter .version { color: #aaaaaa; } 11 | .html-reporter .banner { margin-top: 14px; } 12 | .html-reporter .duration { color: #aaaaaa; float: right; } 13 | .html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; } 14 | .html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; } 15 | .html-reporter .symbol-summary li.passed { font-size: 14px; } 16 | .html-reporter .symbol-summary li.passed:before { color: #5e7d00; content: "\02022"; } 17 | .html-reporter .symbol-summary li.failed { line-height: 9px; } 18 | .html-reporter .symbol-summary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } 19 | .html-reporter .symbol-summary li.disabled { font-size: 14px; } 20 | .html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; } 21 | .html-reporter .symbol-summary li.pending { line-height: 17px; } 22 | .html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; } 23 | .html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } 24 | .html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } 25 | .html-reporter .bar.failed { background-color: #b03911; } 26 | .html-reporter .bar.passed { background-color: #a6b779; } 27 | .html-reporter .bar.skipped { background-color: #bababa; } 28 | .html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; } 29 | .html-reporter .bar.menu a { color: #333333; } 30 | .html-reporter .bar a { color: white; } 31 | .html-reporter.spec-list .bar.menu.failure-list, .html-reporter.spec-list .results .failures { display: none; } 32 | .html-reporter.failure-list .bar.menu.spec-list, .html-reporter.failure-list .summary { display: none; } 33 | .html-reporter .running-alert { background-color: #666666; } 34 | .html-reporter .results { margin-top: 14px; } 35 | .html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } 36 | .html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } 37 | .html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } 38 | .html-reporter.showDetails .summary { display: none; } 39 | .html-reporter.showDetails #details { display: block; } 40 | .html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } 41 | .html-reporter .summary { margin-top: 14px; } 42 | .html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } 43 | .html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; } 44 | .html-reporter .summary li.passed a { color: #5e7d00; } 45 | .html-reporter .summary li.failed a { color: #b03911; } 46 | .html-reporter .summary li.pending a { color: #ba9d37; } 47 | .html-reporter .description + .suite { margin-top: 0; } 48 | .html-reporter .suite { margin-top: 14px; } 49 | .html-reporter .suite a { color: #333333; } 50 | .html-reporter .failures .spec-detail { margin-bottom: 28px; } 51 | .html-reporter .failures .spec-detail .description { background-color: #b03911; } 52 | .html-reporter .failures .spec-detail .description a { color: white; } 53 | .html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; } 54 | .html-reporter .result-message span.result { display: block; } 55 | .html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } 56 | -------------------------------------------------------------------------------- /src/main/webapp/static/validator/vendor/jasmine/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/validator/vendor/jasmine/jasmine_favicon.png -------------------------------------------------------------------------------- /src/main/webapp/static/wangEditor/fonts/w-e-icon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frozen-lin/Blog/688c9dcf37eb99c47e2b977ead687cb0bce5d0e3/src/main/webapp/static/wangEditor/fonts/w-e-icon.woff --------------------------------------------------------------------------------