From 51608c09099e73bec522a146dcd8d3bd9425ef69 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Tue, 12 Jun 2018 12:23:56 +0800 Subject: [PATCH] =?UTF-8?q?:apple:=20=E8=AF=84=E8=AE=BA=E6=A1=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 24 +++++++++- .../controller/api/ApiArchivesController.java | 45 +++++++++++++++++++ .../templates/admin/module/_header.ftl | 2 +- .../common/comment/_native_comment.ftl | 30 ++++++++++++- 4 files changed, 98 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 3ba36e1db..bc5dd83b2 100755 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.1.RELEASE + 2.0.2.RELEASE @@ -149,7 +149,29 @@ true + + + com.upyun + java-sdk + 4.0.1 + + + + + + nexus-aliyun + Nexus aliyun + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + diff --git a/src/main/java/cc/ryanc/halo/web/controller/api/ApiArchivesController.java b/src/main/java/cc/ryanc/halo/web/controller/api/ApiArchivesController.java index 3891dd544..524ce466a 100644 --- a/src/main/java/cc/ryanc/halo/web/controller/api/ApiArchivesController.java +++ b/src/main/java/cc/ryanc/halo/web/controller/api/ApiArchivesController.java @@ -1,8 +1,53 @@ package cc.ryanc.halo.web.controller.api; +import cc.ryanc.halo.model.dto.Archive; +import cc.ryanc.halo.model.dto.JsonResult; +import cc.ryanc.halo.service.PostService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + /** * @author : RYAN0UP * @date : 2018/6/6 */ +@RestController +@RequestMapping(value = "/api/archives") public class ApiArchivesController { + + @Autowired + private PostService postService; + + /** + * 根据年份归档 + * + * @return JsonResult + */ + @GetMapping(value = "/year") + public JsonResult archivesYear(){ + List archives = postService.findPostGroupByYear(); + if(null!=archives || archives.size()>0){ + return new JsonResult(200,"success",archives); + }else { + return new JsonResult(200,"empty"); + } + } + + /** + * 根据月份归档 + * + * @return JsonResult + */ + @GetMapping(value = "/year/month") + public JsonResult archivesYearAndMonth(){ + List archives = postService.findPostGroupByYearAndMonth(); + if(null!=archives || archives.size()>0){ + return new JsonResult(200,"success",archives); + }else { + return new JsonResult(200,"empty"); + } + } } diff --git a/src/main/resources/templates/admin/module/_header.ftl b/src/main/resources/templates/admin/module/_header.ftl index 569dcb70c..32f3bfdb7 100755 --- a/src/main/resources/templates/admin/module/_header.ftl +++ b/src/main/resources/templates/admin/module/_header.ftl @@ -29,7 +29,7 @@
  • - User Image + User Image

    ${comment.commentAuthor} ${comment.commentDate?string("yyyy/MM/dd HH:mm")} diff --git a/src/main/resources/templates/common/comment/_native_comment.ftl b/src/main/resources/templates/common/comment/_native_comment.ftl index 2db560359..f96537f15 100644 --- a/src/main/resources/templates/common/comment/_native_comment.ftl +++ b/src/main/resources/templates/common/comment/_native_comment.ftl @@ -22,6 +22,7 @@ padding: 10px; overflow: hidden; position: relative; + margin-left: 58px; } input, textarea, button { @@ -172,6 +173,22 @@ font-size: 12px; color: #555; } + .comment-avatar{ + position: relative; + float: left; + } + .comment-avatar img{ + border-radius: 100%; + -webkit-transition: 0.4s; + -webkit-transition: -webkit-transform 0.4s ease-out; + transition: transform 0.4s ease-out; + -moz-transition: -moz-transform 0.4s ease-out; + cursor: pointer; + } + + .comment-avatar img:hover{ + transform: rotate(360deg); + } .native-nav{ padding: 10px 0; @@ -193,12 +210,15 @@ }
    +
    + +
    - +
    @@ -258,6 +278,7 @@ $("#commentAuthor").val(localStorage.getItem("author")); $("#commentAuthorEmail").val(localStorage.getItem("email")); $("#commentAuthorUrl").val(localStorage.getItem("url")); + loadAvatar(); }); $('#btn-push').click(function () { var author = $("#commentAuthor"); @@ -310,6 +331,13 @@ $('#commentContent').val("@"+commentParentAuthor+": "); $('#commentContent').focus(); }); + function loadAvatar() { + alert("加载头像") + $(".comment-author-avatar").attr("src","//www.gravatar.com/avatar/"+md5(localStorage.getItem("email"))+"?s=256&d=${options.native_comment_avatar?default('mm')}"); + if($('input[name=commentAuthorEmail]').val()!='' && $('input[name=commentAuthorEmail]').val()!=null){ + $(".comment-author-avatar").attr("src","//www.gravatar.com/avatar/"+md5($('input[name=commentAuthorEmail]').val())+"?s=256&d=${options.native_comment_avatar?default('mm')}"); + } + } var parser = new UAParser(); function show_ua(string){ parser.setUA(string);