Remove useless classes

pull/137/head
johnniang 2019-03-29 00:33:39 +08:00
parent ac4d50c785
commit ac15c7ae48
2 changed files with 0 additions and 100 deletions

View File

@ -1,60 +0,0 @@
package cc.ryanc.halo.utils;
import cn.hutool.core.text.StrBuilder;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.security.MessageDigest;
/**
* <pre>
* hash
* </pre>
*
* @author : Yawn
* @date : 2018/12/04
*/
public class Md5Util {
/**
* MD5
*
* @param file file
* @return byte
* @throws Exception Exception
*/
private static byte[] createChecksum(MultipartFile file) throws Exception {
final InputStream fis = file.getInputStream();
final byte[] buffer = new byte[1024];
final MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
if (numRead > 0) {
complete.update(buffer, 0, numRead);
}
} while (numRead != -1);
fis.close();
return complete.digest();
}
/**
* hash
*
* @param file file
* @return String
* @throws Exception Exception
*/
public static String getMD5Checksum(MultipartFile file) throws Exception {
final byte[] b = createChecksum(file);
StrBuilder result = new StrBuilder();
for (int i = 0; i < b.length; i++) {
result.append(Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1));
}
return result.toString();
}
}

View File

@ -1,40 +0,0 @@
package cc.ryanc.halo.web.controller.admin.base;
import cc.ryanc.halo.service.OptionService;
import cc.ryanc.halo.service.ThemeService;
import freemarker.template.Configuration;
import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import static cc.ryanc.halo.model.support.HaloConst.THEMES;
/**
* Admin base Controller
*
* @author : RYAN0UP
* @date : 2019/3/16
*/
public abstract class BaseController {
@Autowired
public Configuration configuration;
@Autowired
public OptionService optionService;
@Autowired
public ThemeService themeService;
/**
* Clear all caches
*/
public void refreshCache() {
try {
THEMES.clear();
THEMES = themeService.getThemes();
configuration.setSharedVariable("options", optionService.listOptions());
} catch (TemplateModelException e) {
e.printStackTrace();
}
}
}