mirror of https://github.com/halo-dev/halo
🎨 细节优化
parent
5912a50d2c
commit
40af072f95
|
@ -19,6 +19,6 @@ mvn package -Pprod
|
||||||
cd $HALO_DIR/target/dist/halo
|
cd $HALO_DIR/target/dist/halo
|
||||||
|
|
||||||
# 运行Halo
|
# 运行Halo
|
||||||
nohup java -server -Xms256m -Xmx512m -jar `find ./ -name "halo*.jar"` > /dev/null 2>&1 &
|
nohup java -server -jar `find ./ -name "halo*.jar"` > /dev/null 2>&1 &
|
||||||
|
|
||||||
echo "Halo部署完毕,Enjoy!"
|
echo "Halo部署完毕,Enjoy!"
|
|
@ -57,14 +57,19 @@ public class PageController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
LocaleMessageUtil localeMessageUtil;
|
LocaleMessageUtil localeMessageUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LinkService linkService;
|
private LinkService linkService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GalleryService galleryService;
|
private GalleryService galleryService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PostService postService;
|
private PostService postService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LogsService logsService;
|
private LogsService logsService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,10 @@ import java.util.List;
|
||||||
public class FrontArchiveController extends BaseController {
|
public class FrontArchiveController extends BaseController {
|
||||||
|
|
||||||
private static final String POSTS_CACHE_NAME = "posts";
|
private static final String POSTS_CACHE_NAME = "posts";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PostService postService;
|
private PostService postService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommentService commentService;
|
private CommentService commentService;
|
||||||
|
|
||||||
|
|
|
@ -61,41 +61,6 @@ public class FrontCommentController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MailService mailService;
|
private MailService mailService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取文章的评论
|
|
||||||
*
|
|
||||||
* @param postId postId 文章编号
|
|
||||||
*
|
|
||||||
* @return List
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/getComment/{postId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
||||||
@ResponseBody
|
|
||||||
public List<Comment> getComment(@PathVariable Long postId) {
|
|
||||||
final Optional<Post> post = postService.findByPostId(postId);
|
|
||||||
final Sort sort = new Sort(Sort.Direction.DESC, "commentDate");
|
|
||||||
final Pageable pageable = PageRequest.of(0, 999, sort);
|
|
||||||
final List<Comment> comments = commentService.findCommentsByPostAndCommentStatus(post.orElse(new Post()), pageable, CommentStatusEnum.PUBLISHED.getCode()).getContent();
|
|
||||||
return CommentUtil.getComments(comments);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载评论
|
|
||||||
*
|
|
||||||
* @param page 页码
|
|
||||||
* @param post 当前文章
|
|
||||||
*
|
|
||||||
* @return List
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/loadComment")
|
|
||||||
@ResponseBody
|
|
||||||
public List<Comment> loadComment(@RequestParam(value = "page") Integer page,
|
|
||||||
@RequestParam(value = "post") Post post) {
|
|
||||||
final Sort sort = new Sort(Sort.Direction.DESC, "commentDate");
|
|
||||||
final Pageable pageable = PageRequest.of(page - 1, 10, sort);
|
|
||||||
final List<Comment> comments = commentService.findCommentsByPostAndCommentStatus(post, pageable, CommentStatusEnum.PUBLISHED.getCode()).getContent();
|
|
||||||
return comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交新评论
|
* 提交新评论
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input type="hidden" id="postId" name="postId" value="${post.postId?c}">
|
<input type="hidden" id="postId" name="postId" value="${post.postId?c}">
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<input type="text" class="form-control input-lg" id="postTitle" name="postTitle" placeholder="<@spring.message code='admin.posts.edit.form.title.placeholder' />" onblur="autoComplateUrl();" value="${post.postTitle!}">
|
<input type="text" class="form-control input-lg" id="postTitle" name="postTitle" placeholder="<@spring.message code='admin.posts.edit.form.title.placeholder' />" onblur="autoComplateUrl();" value="${post.postTitle!}" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<div style="display: block;margin-bottom: 10px;">
|
<div style="display: block;margin-bottom: 10px;">
|
||||||
<span>
|
<span>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="postPassword" class="control-label">文章密码:</label>
|
<label for="postPassword" class="control-label">文章密码:</label>
|
||||||
<input type="password" class="form-control" id="postPassword" name="postPassword" value="${post.postPassword!}">
|
<input type="password" class="form-control" id="postPassword" name="postPassword" value="${post.postPassword!}" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="postDate" class="control-label">发布时间:</label>
|
<label for="postDate" class="control-label">发布时间:</label>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<input type="text" class="form-control input-lg" id="postTitle" name="postTitle" placeholder="<@spring.message code='admin.posts.edit.form.title.placeholder' />" onblur="autoComplateUrl();">
|
<input type="text" class="form-control input-lg" id="postTitle" name="postTitle" placeholder="<@spring.message code='admin.posts.edit.form.title.placeholder' />" onblur="autoComplateUrl();" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<div style="display: block;margin-bottom: 10px;">
|
<div style="display: block;margin-bottom: 10px;">
|
||||||
<span>
|
<span>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="postPassword" class="control-label">文章密码:</label>
|
<label for="postPassword" class="control-label">文章密码:</label>
|
||||||
<input type="password" class="form-control" id="postPassword" name="postPassword">
|
<input type="password" class="form-control" id="postPassword" name="postPassword" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
|
|
Loading…
Reference in New Issue