mirror of https://github.com/halo-dev/halo
👽 修复了一些放我犯强迫症的地方:)
parent
f57d8254e0
commit
a6d72991ff
|
@ -11,8 +11,8 @@ import org.springframework.web.servlet.config.annotation.*;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/2
|
||||
* @version : 1.0
|
||||
* description:
|
||||
*/
|
||||
@Slf4j
|
||||
|
@ -22,8 +22,6 @@ import org.springframework.web.servlet.config.annotation.*;
|
|||
@PropertySource(value = "classpath:application.yaml",ignoreResourceNotFound = true,encoding = "UTF-8")
|
||||
public class MvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private LoginInterceptor loginInterceptor;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/20
|
||||
* @version : 1.0
|
||||
* description : 文章归档数据
|
||||
*/
|
||||
@Data
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Map;
|
|||
* description: 环境常量
|
||||
*/
|
||||
public class HaloConst {
|
||||
|
||||
/**
|
||||
* 所有设置选项(key,value)
|
||||
*/
|
||||
|
|
|
@ -2,9 +2,9 @@ package cc.ryanc.halo.model.dto;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/19
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/19
|
||||
*/
|
||||
public interface LogsRecord {
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.io.Serializable;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/3
|
||||
* @version : 1.0
|
||||
* description : 主题数据
|
||||
*/
|
||||
@Data
|
||||
|
|
|
@ -7,9 +7,9 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/10
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/10
|
||||
*/
|
||||
public interface AttachmentRepository extends JpaRepository<Attachment,Long>{
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/22
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/22
|
||||
*/
|
||||
public interface CommentRepository extends JpaRepository<Comment,Long> {
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface GalleryRepository extends JpaRepository<Gallery,Long> {
|
||||
|
|
|
@ -4,9 +4,9 @@ import cc.ryanc.halo.model.domain.Link;
|
|||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* className: LinkRepository
|
||||
* @author : RYAN0UP
|
||||
* @date : 2017/11/14
|
||||
* @version : 1.0
|
||||
* description: 友情链接持久层
|
||||
*/
|
||||
public interface LinkRepository extends JpaRepository<Link,Long>{
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/19
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface LogsRepository extends JpaRepository<Logs,Long> {
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/24
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface MenuRepository extends JpaRepository<Menu,Long> {
|
||||
|
|
|
@ -13,8 +13,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2017/11/14
|
||||
* @version : 1.0
|
||||
* description : 文章持久层
|
||||
*/
|
||||
public interface PostRepository extends JpaRepository<Post,Long>{
|
||||
|
|
|
@ -5,9 +5,9 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/12
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/12
|
||||
*/
|
||||
public interface TagRepository extends JpaRepository<Tag,Long>{
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/10
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/10
|
||||
*/
|
||||
public interface AttachmentService {
|
||||
|
||||
/**
|
||||
* 添加附件信息
|
||||
*
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Optional;
|
|||
* description :
|
||||
*/
|
||||
public interface CategoryService {
|
||||
|
||||
/**
|
||||
* 新增分类目录
|
||||
*
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/22
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface CommentService {
|
||||
|
|
|
@ -9,8 +9,8 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface GalleryService {
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Optional;
|
|||
* description:
|
||||
*/
|
||||
public interface LinkService {
|
||||
|
||||
/**
|
||||
* 新增友情链接
|
||||
*
|
||||
|
|
|
@ -9,9 +9,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/19
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/19
|
||||
*/
|
||||
public interface LogsService {
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/23
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/23
|
||||
*/
|
||||
public interface MailService {
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/24
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/24
|
||||
*/
|
||||
public interface MenuService {
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Map;
|
|||
*/
|
||||
public interface OptionsService {
|
||||
|
||||
|
||||
/**
|
||||
* 保存单个设置选项
|
||||
*
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Optional;
|
|||
* description :
|
||||
*/
|
||||
public interface PostService {
|
||||
|
||||
/**
|
||||
* 新增文章
|
||||
*
|
||||
|
|
|
@ -7,8 +7,8 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/12
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
public interface TagService {
|
||||
|
|
|
@ -7,11 +7,12 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2017/11/14
|
||||
* @version : 1.0
|
||||
* description:
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 保存个人资料
|
||||
*
|
||||
|
@ -41,7 +42,7 @@ public interface UserService {
|
|||
*
|
||||
* @return list
|
||||
*/
|
||||
List<User> findAllUser();
|
||||
User findUser();
|
||||
|
||||
/**
|
||||
* 根据用户编号和密码查询
|
||||
|
|
|
@ -13,9 +13,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/10
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/10
|
||||
*/
|
||||
@Service
|
||||
public class AttachmentServiceImpl implements AttachmentService{
|
||||
|
|
|
@ -15,9 +15,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/22
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/22
|
||||
*/
|
||||
@Service
|
||||
public class CommentServiceImpl implements CommentService {
|
||||
|
|
|
@ -13,8 +13,8 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
@Service
|
||||
|
|
|
@ -13,9 +13,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/19
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/19
|
||||
*/
|
||||
@Service
|
||||
public class LogsServiceImpl implements LogsService {
|
||||
|
|
|
@ -14,9 +14,9 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/23
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/23
|
||||
*/
|
||||
@Service
|
||||
public class MailServiceImpl implements MailService{
|
||||
|
|
|
@ -11,9 +11,9 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/24
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/24
|
||||
*/
|
||||
@Service
|
||||
public class MenuServiceImpl implements MenuService{
|
||||
|
|
|
@ -15,8 +15,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2017/11/14
|
||||
* @version : 1.0
|
||||
* description:
|
||||
*/
|
||||
@Service
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.Optional;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/12
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
@Service
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2017/11/14
|
||||
* @version : 1.0
|
||||
* description:
|
||||
*/
|
||||
@Service
|
||||
|
@ -61,8 +61,8 @@ public class UserServiceImpl implements UserService {
|
|||
* @return list
|
||||
*/
|
||||
@Override
|
||||
public List<User> findAllUser() {
|
||||
return userRepository.findAll();
|
||||
public User findUser() {
|
||||
return userRepository.findAll().get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public void updateUserLoginEnable(String enable) {
|
||||
User user = this.findAllUser().get(0);
|
||||
User user = this.findUser();
|
||||
user.setLoginEnable(enable);
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public User updateUserLoginLast(Date lastDate) {
|
||||
User user = this.findAllUser().get(0);
|
||||
User user = this.findUser();
|
||||
user.setLoginLast(lastDate);
|
||||
userRepository.save(user);
|
||||
return user;
|
||||
|
@ -109,7 +109,7 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public Integer updateUserLoginError() {
|
||||
User user = this.findAllUser().get(0);
|
||||
User user = this.findUser();
|
||||
user.setLoginError(user.getLoginError()+1);
|
||||
userRepository.save(user);
|
||||
return user.getLoginError();
|
||||
|
@ -120,7 +120,7 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public User updateUserNormal() {
|
||||
User user = this.findAllUser().get(0);
|
||||
User user = this.findUser();
|
||||
user.setLoginEnable("true");
|
||||
user.setLoginError(0);
|
||||
user.setLoginLast(new Date());
|
||||
|
|
|
@ -100,8 +100,8 @@ public class IndexController extends BaseController{
|
|||
model.addAttribute("is_home",true);
|
||||
|
||||
//用户信息
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
//所有分类目录
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
|
@ -177,8 +177,8 @@ public class IndexController extends BaseController{
|
|||
model.addAttribute("postsCount",postService.findAllPosts().size());
|
||||
|
||||
//用户信息
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
//所有分类目录
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
|
@ -267,8 +267,8 @@ public class IndexController extends BaseController{
|
|||
model.addAttribute("links",links);
|
||||
|
||||
//用户信息
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
model.addAttribute("is_links",true);
|
||||
|
||||
|
@ -308,8 +308,8 @@ public class IndexController extends BaseController{
|
|||
List<Category> categories = categoryService.findAllCategories();
|
||||
model.addAttribute("categories",categories);
|
||||
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
//文章总数
|
||||
model.addAttribute("postsCount",postService.findAllPosts().size());
|
||||
|
@ -380,8 +380,8 @@ public class IndexController extends BaseController{
|
|||
model.addAttribute("archives",archives);
|
||||
|
||||
//用户信息
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
//菜单列表
|
||||
List<Menu> menus = menuService.findAllMenus();
|
||||
|
@ -424,8 +424,8 @@ public class IndexController extends BaseController{
|
|||
model.addAttribute("postsCount",postService.findAllPosts().size());
|
||||
|
||||
//用户信息
|
||||
List<User> users = userService.findAllUser();
|
||||
model.addAttribute("user",users.get(0));
|
||||
User user = userService.findUser();
|
||||
model.addAttribute("user",user);
|
||||
|
||||
//分类目录
|
||||
List<Category> categories = categoryService.findAllCategories();
|
||||
|
@ -505,12 +505,12 @@ public class IndexController extends BaseController{
|
|||
try {
|
||||
//发送邮件到博主
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("author",userService.findAllUser().get(0).getUserDisplayName());
|
||||
map.put("author",userService.findUser().getUserDisplayName());
|
||||
map.put("pageName",postService.findByPostId(post.getPostId()).get().getPostTitle());
|
||||
map.put("siteUrl",HaloConst.OPTIONS.get("site_url"));
|
||||
map.put("visitor",comment.getCommentAuthor());
|
||||
map.put("commentContent",comment.getCommentContent());
|
||||
mailService.sendTemplateMail(userService.findAllUser().get(0).getUserEmail(),"有新的评论",map,"common/mail/mail_admin.ftl");
|
||||
mailService.sendTemplateMail(userService.findUser().getUserEmail(),"有新的评论",map,"common/mail/mail_admin.ftl");
|
||||
}catch (Exception e){
|
||||
log.error("邮件服务器未配置:"+e.getMessage());
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/28
|
||||
* @version : 1.0
|
||||
* description : 安装控制器
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
|
@ -120,7 +120,7 @@ public class AdminController extends BaseController{
|
|||
HttpSession session){
|
||||
String status = "false";
|
||||
try {
|
||||
User aUser = userService.findAllUser().get(0);
|
||||
User aUser = userService.findUser();
|
||||
User user = null;
|
||||
if("false".equals(aUser.getLoginEnable())){
|
||||
status = "disable";
|
||||
|
|
|
@ -29,7 +29,6 @@ public class BackupController {
|
|||
@Autowired
|
||||
private PostService postService;
|
||||
|
||||
|
||||
/**
|
||||
* 渲染备份页面
|
||||
*
|
||||
|
|
|
@ -125,7 +125,7 @@ public class CommentController extends BaseController{
|
|||
map.put("commentContent", comment.getCommentContent());
|
||||
map.put("siteUrl", HaloConst.OPTIONS.get("site_url"));
|
||||
map.put("siteTitle", HaloConst.OPTIONS.get("site_title"));
|
||||
map.put("author", userService.findAllUser().get(0).getUserDisplayName());
|
||||
map.put("author", userService.findUser().getUserDisplayName());
|
||||
mailService.sendTemplateMail(
|
||||
comment.getCommentAuthorEmail(),
|
||||
"您在" + HaloConst.OPTIONS.get("site_title") + "的评论已审核通过!", map, "common/mail/mail_passed.ftl");
|
||||
|
@ -184,6 +184,10 @@ public class CommentController extends BaseController{
|
|||
//被回复的评论
|
||||
Comment lastComment = commentService.findCommentById(commentId).get();
|
||||
|
||||
//修改被回复的评论的状态
|
||||
lastComment.setCommentStatus(0);
|
||||
commentService.saveByComment(lastComment);
|
||||
|
||||
//保存评论
|
||||
Comment comment = new Comment();
|
||||
comment.setPost(post);
|
||||
|
@ -191,7 +195,7 @@ public class CommentController extends BaseController{
|
|||
comment.setCommentAuthorEmail(user.getUserEmail());
|
||||
comment.setCommentAuthorUrl(HaloConst.OPTIONS.get("site_url"));
|
||||
comment.setCommentAuthorIp(HaloUtil.getIpAddr(request));
|
||||
comment.setCommentAuthorAvatarMd5(HaloUtil.getMD5(userService.findAllUser().get(0).getUserEmail()));
|
||||
comment.setCommentAuthorAvatarMd5(HaloUtil.getMD5(userService.findUser().getUserEmail()));
|
||||
comment.setCommentDate(new Date());
|
||||
String lastContent = " //<a href='#'>@"+lastComment.getCommentAuthor()+"</a>:"+lastComment.getCommentContent();
|
||||
comment.setCommentContent(commentContent+lastContent);
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/2/26
|
||||
* @version : 1.0
|
||||
* description :
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
|
@ -16,9 +16,9 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @date : 2018/1/30
|
||||
* @version : 1.0
|
||||
* description :
|
||||
* @date : 2018/1/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
|
|
|
@ -33,7 +33,7 @@ public class UserController {
|
|||
*/
|
||||
@GetMapping
|
||||
public String profile(Model model){
|
||||
model.addAttribute("user",userService.findAllUser().get(0));
|
||||
model.addAttribute("user",userService.findUser());
|
||||
//设置选项
|
||||
model.addAttribute("options",HaloConst.OPTIONS);
|
||||
return "admin/admin_profile";
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.io.File;
|
|||
|
||||
/**
|
||||
* @author : RYAN0UP
|
||||
* @version : 1.0
|
||||
* @date : 2018/1/28
|
||||
* @version : 1.0
|
||||
* description : 安装拦截器
|
||||
*/
|
||||
@Component
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<#break >
|
||||
<#case 1>
|
||||
<a class="btn btn-info btn-sm btn-flat" href="/admin/comments/revert?commentId=${comment.commentId}&status=1">通过</a>
|
||||
<a class="btn btn-primary btn-sm btn-flat" onclick="replyShow('${comment.commentId}','${comment.post.postId}')">通过并回复</a>
|
||||
<button class="btn btn-danger btn-sm btn-flat" onclick="modelShow('/admin/comments/throw?commentId=${comment.commentId}','确定移动到回收站?')">丢弃</button>
|
||||
<#break >
|
||||
<#case 2>
|
||||
|
|
Loading…
Reference in New Issue