fix: 添加评论头像,v2ex邮箱解析

This commit is contained in:
josxy 2021-04-23 23:10:34 +08:00
parent d1be6600b2
commit ed74e52589
2 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import cn.allms.po.User;
import cn.allms.po.Comment; import cn.allms.po.Comment;
import cn.allms.service.BlogService; import cn.allms.service.BlogService;
import cn.allms.service.CommentService; import cn.allms.service.CommentService;
import cn.allms.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -29,6 +30,9 @@ public class CommentController {
@Value("${comment.avatar}") @Value("${comment.avatar}")
private String avatar; private String avatar;
@Value("${comment.v2exUrl}")
private String v2exUrl;
/** /**
* 显示评论列表 * 显示评论列表
* @param blogId * @param blogId
@ -60,7 +64,7 @@ public class CommentController {
comment.setEmail(user.getEmail()); comment.setEmail(user.getEmail());
//普通用户 //普通用户
} else { } else {
comment.setAvatar(avatar); comment.setAvatar(v2exUrl + MD5Utils.code(comment.getEmail()));
} }
commentServiceImpl.saveComment(comment); commentServiceImpl.saveComment(comment);
return "redirect:/comments/" +blogId; return "redirect:/comments/" +blogId;

View File

@ -7,5 +7,7 @@ spring:
messages: messages:
basename: i18n/message basename: i18n/message
#博客头像
comment.avatar: /images/avatar.png comment:
v2exUrl: https://sdn.geekzu.org/avatar/
avatar: /images/avatar.png