Skip to content

Commit

Permalink
👽 1.新增后台加载动画,提升使用体验,修改部分设置选项字段。
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Apr 20, 2018
1 parent 1905b6e commit 089a749
Show file tree
Hide file tree
Showing 118 changed files with 5,892 additions and 425 deletions.
2 changes: 1 addition & 1 deletion assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<id>distribution</id>
<formats>
<format>zip</format>
<format>dir</format>
</formats>

<includeBaseDirectory>false</includeBaseDirectory>
Expand Down
4 changes: 2 additions & 2 deletions bin/halo.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
APP_NAME=halo-*.jar
APP_NAME=halo-beta.jar

usage() {
echo "用法: sh halo.sh [start(启动)|stop(停止)|restart(重启)|status(状态)]"
Expand All @@ -20,7 +20,7 @@ start(){
if [ $? -eq "0" ]; then
echo "${APP_NAME} 正在运行。 pid=${pid} ."
else
nohup java -jar $APP_NAME > /dev/null 2>&1 &
nohup java -Xms512m -Xmx768m -jar $APP_NAME > /dev/null 2>&1 &
echo "${APP_NAME}启动成功,请查看日志确保运行正常。"
fi
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/cc/ryanc/halo/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

/**
* @author RYAN0UP
* SpringBoot启动类
*/
@SpringBootApplication
@EnableCaching
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import cc.ryanc.halo.repository.AttachmentRepository;
import cc.ryanc.halo.service.AttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand All @@ -23,10 +26,6 @@ public class AttachmentServiceImpl implements AttachmentService{
@Autowired
private AttachmentRepository attachmentRepository;

private static final String CATEGORY_KEY = "'category_key'";

private static final String CATEGORY_CACHE_NAME = "cateCache";

/**
* 新增附件信息
*
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/cc/ryanc/halo/service/impl/CategoryServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,23 @@ public class CategoryServiceImpl implements CategoryService{
@Autowired
private CategoryRepository categoryRepository;

private static final String CATEGORY_KEY = "'category_key'";

private static final String CATEGORY_CACHE_NAME = "cate_cache";

/**
* 保存/修改分类目录 清除缓存
* 保存/修改分类目录
*
* @param category 分类目录
* @return ategory
*/
@CacheEvict(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
@Override
public Category saveByCategory(Category category) {
return categoryRepository.save(category);
}

/**
* 根据编号移除分类目录 清除缓存
* 根据编号移除分类目录
*
* @param cateId 分类目录编号
* @return Category
*/
@CacheEvict(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
@Override
public Category removeByCateId(Long cateId) {
Optional<Category> category = this.findByCateId(cateId);
Expand All @@ -55,23 +49,21 @@ public Category removeByCateId(Long cateId) {
}

/**
* 查询所有分类目录 缓存
* 查询所有分类目录
*
* @return list
*/
@Cacheable(value = CATEGORY_CACHE_NAME,key = CATEGORY_KEY)
@Override
public List<Category> findAllCategories() {
return categoryRepository.findAll();
}

/**
* 根据编号查询分类目录 缓存
* 根据编号查询分类目录
*
* @param cateId 分类编号
* @return Category
*/
@Cacheable(value = CATEGORY_CACHE_NAME,key = "#cateId+'cate'")
@Override
public Optional<Category> findByCateId(Long cateId) {
return categoryRepository.findById(cateId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Page<Comment> findAllComments(Integer status, Pageable pageable) {
/**
* 查询所有评论,不分页
*
* @return
* @return List<Comment></>
*/
@Override
public List<Comment> findAllComments() {
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/cc/ryanc/halo/service/impl/LinkServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,23 @@ public class LinkServiceImpl implements LinkService {
@Autowired
private LinkRepository linkRepository;

private static final String LINK_KEY = "'link_key'";

private static final String LINK_CACHE_NAME = "link_cache";

/**
* 新增/修改友情链接 清除缓存
* 新增/修改友情链接
*
* @param link link
* @return Link
*/
@CacheEvict(value = LINK_CACHE_NAME,key = LINK_KEY)
@Override
public Link saveByLink(Link link) {
return linkRepository.save(link);
}

/**
* 移除友情链接 清除缓存
* 移除友情链接
*
* @param linkId linkId
* @return link
*/
@CacheEvict(value = LINK_CACHE_NAME,key = LINK_KEY)
@Override
public Link removeByLinkId(Long linkId) {
Optional<Link> link = this.findByLinkId(linkId);
Expand All @@ -54,23 +48,21 @@ public Link removeByLinkId(Long linkId) {
}

/**
* 查询所有友情链接 缓存
* 查询所有友情链接
*
* @return list
*/
@Cacheable(value = LINK_CACHE_NAME,key = LINK_KEY)
@Override
public List<Link> findAllLinks() {
return linkRepository.findAll();
}

/**
* 根据编号查询友情链接 缓存
* 根据编号查询友情链接
*
* @param linkId linkId
* @return Link
*/
@Cacheable(value = LINK_CACHE_NAME,key = "#linkId+'link'")
@Override
public Optional<Link> findByLinkId(Long linkId) {
return linkRepository.findById(linkId);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/cc/ryanc/halo/service/impl/MailServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class MailServiceImpl implements MailService{
/**
* 发送邮件
*
* @param to to
* @param subject subject
* @param content content
* @param to to 接收者
* @param subject subject 标题
* @param content content 内容
*/
@Override
public void sendMail (String to, String subject, String content){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ public class OptionsServiceImpl implements OptionsService {
@Autowired
private OptionsRepository optionsRepository;

private static final String OPTIONS_KEY = "'options_key'";

private static final String OPTIONS_CACHE_NAME = "options_cache";

/**
* 批量保存设置
*
* @param options options
*/
@CacheEvict(value = OPTIONS_CACHE_NAME,key = OPTIONS_KEY)
@Override
public void saveOptions(Map<String,String> options){
if(null != options && !options.isEmpty()){
Expand All @@ -48,7 +43,6 @@ public void saveOptions(Map<String,String> options){
* @param key key
* @param value value
*/
@CacheEvict(value = OPTIONS_CACHE_NAME,key = OPTIONS_KEY)
@Override
public void saveOption(String key,String value){
Options options = null;
Expand Down Expand Up @@ -78,7 +72,6 @@ public void saveOption(String key,String value){
*
* @param options options
*/
@CacheEvict(value = OPTIONS_CACHE_NAME,key = OPTIONS_KEY)
@Override
public void removeOption(Options options) {
optionsRepository.delete(options);
Expand All @@ -89,7 +82,6 @@ public void removeOption(Options options) {
*
* @return map
*/
@Cacheable(value = OPTIONS_CACHE_NAME,key = OPTIONS_KEY)
@Override
public Map<String, String> findAllOptions() {
Map<String,String> options = new HashMap<String,String>();
Expand All @@ -106,7 +98,6 @@ public Map<String, String> findAllOptions() {
* @param key key
* @return String
*/
@Cacheable(value = OPTIONS_CACHE_NAME,key = "#key+'options'")
@Override
public String findOneOption(String key) {
Options options = optionsRepository.findOptionsByOptionName(key);
Expand Down
Loading

0 comments on commit 089a749

Please sign in to comment.