From 6941b984be66806eaad983495ed5f7fb34112230 Mon Sep 17 00:00:00 2001
From: TikiWong <778563781@qq.com>
Date: Thu, 27 Jan 2022 14:18:41 +0800
Subject: [PATCH 1/7] =?UTF-8?q?[=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96]=20?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E7=9A=84?=
=?UTF-8?q?=E5=8F=AF=E5=9B=9E=E6=94=B6=E7=94=A8=E6=88=B7=E7=BC=93=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../security/service/UserCacheClean.java | 8 +-
.../security/service/UserCacheManager.java | 110 ++++++++++++++++++
.../service/UserDetailsServiceImpl.java | 37 +++---
.../src/main/resources/config/application.yml | 9 ++
.../test/java/me/zhengjie/LoginCacheTest.java | 20 ++++
5 files changed, 161 insertions(+), 23 deletions(-)
create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheClean.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheClean.java
index 70292269..fdddde31 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheClean.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheClean.java
@@ -16,6 +16,7 @@
package me.zhengjie.modules.security.service;
+import lombok.AllArgsConstructor;
import me.zhengjie.utils.StringUtils;
import org.springframework.stereotype.Component;
@@ -25,8 +26,11 @@ import org.springframework.stereotype.Component;
* @apiNote: 用于清理 用户登录信息缓存,为防止Spring循环依赖与安全考虑 ,单独构成工具类
*/
@Component
+@AllArgsConstructor
public class UserCacheClean {
+ private final UserCacheManager userCacheManager;
+
/**
* 清理特定用户缓存信息
* 用户信息变更时
@@ -35,7 +39,7 @@ public class UserCacheClean {
*/
public void cleanUserCache(String userName) {
if (StringUtils.isNotEmpty(userName)) {
- UserDetailsServiceImpl.USER_DTO_CACHE.remove(userName);
+ userCacheManager.remove(userName);
}
}
@@ -44,6 +48,6 @@ public class UserCacheClean {
* ,如发生角色授权信息变化,可以简便的全部失效缓存
*/
public void cleanAll() {
- UserDetailsServiceImpl.USER_DTO_CACHE.clear();
+ userCacheManager.clear();
}
}
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
new file mode 100644
index 00000000..3f8a8a4a
--- /dev/null
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
@@ -0,0 +1,110 @@
+package me.zhengjie.modules.security.service;
+
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.modules.security.service.dto.JwtUserDto;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * 用户缓存
+ *
+ * @author TikiWong
+ * @date 2022/1/27 8:23
+ **/
+@Slf4j
+@Component
+public class UserCacheManager {
+
+ @Value("${user-cache.min-evictable-size}")
+ private int minEvictableSize;
+ @Value("${user-cache.min-evictable-interval}")
+ private long minEvictableInterval;
+ @Value("${user-cache.min-idle-time}")
+ private long minIdleTime;
+
+ private final Map cache = new ConcurrentHashMap<>();
+ private final AtomicBoolean expelLock = new AtomicBoolean(true);
+ private long nextMinEvictableTime = 0;
+
+ public Future putIfAbsent(String username, Future ft) {
+ Node tryNode = new Node(ft);
+ Node node = cache.putIfAbsent(username, tryNode);
+ expel();
+ return nodeToDate(node);
+ }
+
+ /**
+ * 缓存回收
+ * 为避免超过边界后回收热点数据设置了最小生存时间
+ * 回收时会保留在最小生存时间内的数据
+ **/
+ public void expel() {
+ long now = System.currentTimeMillis();
+ if (cache.size() < minEvictableSize ||
+ now < nextMinEvictableTime &&
+ !expelLock.compareAndSet(true, false)) {
+ return;
+ }
+ long oldestTime = now;
+ int evictedCount = 0;
+ try {
+ Iterator> iterator = cache.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry entry = iterator.next();
+ long nodeTime = entry.getValue().getTime();
+ if (nodeTime + minIdleTime < now) {
+ iterator.remove();
+ evictedCount++;
+ }
+ oldestTime = Math.min(oldestTime, nodeTime);
+ }
+ } finally {
+ this.nextMinEvictableTime = Math.max(now + minEvictableInterval, oldestTime);
+ expelLock.set(true);
+ log.info("回收掉【{}】条用户缓存, 剩余缓存数为【{}】,下次可回收时间为【{}】秒后",
+ evictedCount,
+ cache.size(),
+ (this.nextMinEvictableTime - now) / 1000);
+ }
+ }
+
+ public Future get(String username) {
+ return nodeToDate(cache.get(username));
+ }
+
+ public void clear() {
+ cache.clear();
+ }
+
+ public void remove(String username) {
+ cache.remove(username);
+ }
+
+ private Future nodeToDate(Node node) {
+ return node == null ? null : node.getData();
+ }
+
+ private static class Node {
+ private final Future data;
+ private final long time;
+
+ public Node(Future data) {
+ this.data = data;
+ this.time = System.currentTimeMillis();
+ }
+
+ public Future getData() {
+ return data;
+ }
+
+ public long getTime() {
+ return time;
+ }
+ }
+}
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
index 51d09fb8..7e5befd9 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
@@ -29,7 +29,6 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
@@ -45,17 +44,12 @@ public class UserDetailsServiceImpl implements UserDetailsService {
private final DataService dataService;
private final LoginProperties loginProperties;
+ private final UserCacheManager USER_DTO_CACHE;
+
public void setEnableCache(boolean enableCache) {
this.loginProperties.setCacheEnable(enableCache);
}
- /**
- * 用户信息缓存
- *
- * @see {@link UserCacheClean}
- */
-
- final static Map> USER_DTO_CACHE = new ConcurrentHashMap<>();
public static ExecutorService executor = newThreadPool();
@Override
@@ -68,7 +62,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
user = userService.findByName(username);
} catch (EntityNotFoundException e) {
// SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException
- throw new UsernameNotFoundException("", e);
+ throw new UsernameNotFoundException(username, e);
}
if (user == null) {
throw new UsernameNotFoundException("");
@@ -85,25 +79,26 @@ public class UserDetailsServiceImpl implements UserDetailsService {
return jwtUserDto;
}
- if (future==null) {
- Callable call=()->getJwtBySearchDb(username);
- FutureTask ft=new FutureTask<>(call);
- future=USER_DTO_CACHE.putIfAbsent(username,ft);
- if(future==null){
- future=ft;
+ if (future == null) {
+ Callable call = () -> getJwtBySearchDb(username);
+ FutureTask ft = new FutureTask<>(call);
+ future = USER_DTO_CACHE.putIfAbsent(username, ft);
+ if (future == null) {
+ future = ft;
executor.submit(ft);
}
- try{
+ try {
return future.get();
- }catch(CancellationException e){
+ } catch (CancellationException e) {
USER_DTO_CACHE.remove(username);
- }catch (InterruptedException | ExecutionException e) {
+ System.out.println("error" + Thread.currentThread().getName());
+ } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e.getMessage());
}
- }else{
+ } else {
try {
- jwtUserDto=future.get();
- }catch (InterruptedException | ExecutionException e) {
+ jwtUserDto = future.get();
+ } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e.getMessage());
}
// 检查dataScope是否修改
diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml
index 7b5316cb..8a3b228a 100644
--- a/eladmin-system/src/main/resources/config/application.yml
+++ b/eladmin-system/src/main/resources/config/application.yml
@@ -54,3 +54,12 @@ code:
#密码加密传输,前端公钥加密,后端私钥解密
rsa:
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
+
+# 内存用户缓存配置
+user-cache:
+ # 最小回收数(当缓存数量达到此值时进行回收)
+ min-evictable-size: 512
+ # 最小回收间隔
+ min-evictable-interval: 1800000
+ # 最小存活时间 (ms)
+ min-idle-time: 3600000
\ No newline at end of file
diff --git a/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java b/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java
index ef608495..4cae4a8f 100644
--- a/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java
+++ b/eladmin-system/src/test/java/me/zhengjie/LoginCacheTest.java
@@ -41,4 +41,24 @@ public class LoginCacheTest {
System.out.print("使用缓存:" + (end1 - start1) + "毫秒\n 不使用缓存:" + (end2 - start2) + "毫秒");
}
+ @Test
+ public void testCacheManager() throws InterruptedException {
+ int size = 1000;
+ CountDownLatch latch = new CountDownLatch(size);
+ for (int i = 0; i < size; i++) {
+ int mod = i % 10;
+ executor.submit(() -> {
+ try {
+ Thread.sleep(mod * 2 + (int) (Math.random() * 10000));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ userDetailsService.loadUserByUsername("admin" + mod);
+ latch.countDown();
+ System.out.println("剩余未完成数量" + latch.getCount());
+ });
+ }
+ latch.await();
+ }
+
}
From c9614bd77c67d97c8532b20f7f831de970ed632f Mon Sep 17 00:00:00 2001
From: TikiWong <778563781@qq.com>
Date: Thu, 27 Jan 2022 14:29:59 +0800
Subject: [PATCH 2/7] =?UTF-8?q?=E7=AC=94=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../zhengjie/modules/security/service/UserCacheManager.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
index 3f8a8a4a..8eaccd5f 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserCacheManager.java
@@ -47,8 +47,8 @@ public class UserCacheManager {
public void expel() {
long now = System.currentTimeMillis();
if (cache.size() < minEvictableSize ||
- now < nextMinEvictableTime &&
- !expelLock.compareAndSet(true, false)) {
+ now < nextMinEvictableTime ||
+ !expelLock.compareAndSet(true, false)) {
return;
}
long oldestTime = now;
From e06ec08400c8e3931ab5e177a0e156cb743049f9 Mon Sep 17 00:00:00 2001
From: YJRY <33829084+YJRY@users.noreply.github.com>
Date: Fri, 4 Mar 2022 09:52:37 +0800
Subject: [PATCH 3/7] =?UTF-8?q?[=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96]?=
=?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=80=BC=E8=B0=83=E6=95=B4=E4=B8=BA=E7=BB=9F?=
=?UTF-8?q?=E4=B8=80=E5=A4=A7=E5=86=99=EF=BC=9B=E6=9E=9A=E4=B8=BE=E7=9A=84?=
=?UTF-8?q?find=E6=96=B9=E6=B3=95=E4=BC=98=E5=8C=96=20(#730)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: xuqi
---
.../java/me/zhengjie/utils/enums/CodeBiEnum.java | 2 +-
.../java/me/zhengjie/utils/enums/DataScopeEnum.java | 2 +-
.../me/zhengjie/utils/enums/RequestMethodEnum.java | 2 +-
.../modules/security/config/bean/LoginCodeEnum.java | 10 +++++-----
.../security/config/bean/LoginProperties.java | 12 ++++++------
.../security/rest/AuthorizationController.java | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/CodeBiEnum.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/CodeBiEnum.java
index 661e0a0c..944bc71c 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/enums/CodeBiEnum.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/CodeBiEnum.java
@@ -40,7 +40,7 @@ public enum CodeBiEnum {
public static CodeBiEnum find(Integer code) {
for (CodeBiEnum value : CodeBiEnum.values()) {
- if (code.equals(value.getCode())) {
+ if (value.getCode().equals(code)) {
return value;
}
}
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/DataScopeEnum.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/DataScopeEnum.java
index 5352b7bb..465eef65 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/enums/DataScopeEnum.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/DataScopeEnum.java
@@ -43,7 +43,7 @@ public enum DataScopeEnum {
public static DataScopeEnum find(String val) {
for (DataScopeEnum dataScopeEnum : DataScopeEnum.values()) {
- if (val.equals(dataScopeEnum.getValue())) {
+ if (dataScopeEnum.getValue().equals(val)) {
return dataScopeEnum;
}
}
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/RequestMethodEnum.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/RequestMethodEnum.java
index 1b65c786..35e42b80 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/enums/RequestMethodEnum.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/RequestMethodEnum.java
@@ -65,7 +65,7 @@ public enum RequestMethodEnum {
public static RequestMethodEnum find(String type) {
for (RequestMethodEnum value : RequestMethodEnum.values()) {
- if (type.equals(value.getType())) {
+ if (value.getType().equals(type)) {
return value;
}
}
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java
index 9ff398f2..685ccbbb 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java
@@ -26,18 +26,18 @@ public enum LoginCodeEnum {
/**
* 算数
*/
- arithmetic,
+ ARITHMETIC,
/**
* 中文
*/
- chinese,
+ CHINESE,
/**
* 中文闪图
*/
- chinese_gif,
+ CHINESE_GIF,
/**
* 闪图
*/
- gif,
- spec
+ GIF,
+ SPEC
}
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java
index b13f173e..7ce91fc8 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java
@@ -62,7 +62,7 @@ public class LoginProperties {
if (Objects.isNull(loginCode)) {
loginCode = new LoginCode();
if (Objects.isNull(loginCode.getCodeType())) {
- loginCode.setCodeType(LoginCodeEnum.arithmetic);
+ loginCode.setCodeType(LoginCodeEnum.ARITHMETIC);
}
}
return switchCaptcha(loginCode);
@@ -78,25 +78,25 @@ public class LoginProperties {
Captcha captcha;
synchronized (this) {
switch (loginCode.getCodeType()) {
- case arithmetic:
+ case ARITHMETIC:
// 算术类型 https://gitee.com/whvse/EasyCaptcha
captcha = new FixedArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight());
// 几位数运算,默认是两位
captcha.setLen(loginCode.getLength());
break;
- case chinese:
+ case CHINESE:
captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
- case chinese_gif:
+ case CHINESE_GIF:
captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
- case gif:
+ case GIF:
captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
- case spec:
+ case SPEC:
captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
index 9646d73b..634356d5 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
@@ -123,7 +123,7 @@ public class AuthorizationController {
String uuid = properties.getCodeKey() + IdUtil.simpleUUID();
//当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型
String captchaValue = captcha.text();
- if (captcha.getCharType() - 1 == LoginCodeEnum.arithmetic.ordinal() && captchaValue.contains(".")) {
+ if (captcha.getCharType() - 1 == LoginCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(".")) {
captchaValue = captchaValue.split("\\.")[0];
}
// 保存
From b9aca9366d5e096445b624d37c0c05ba0e873f57 Mon Sep 17 00:00:00 2001
From: Zheng Jie <201507802@qq.com>
Date: Mon, 7 Mar 2022 14:12:58 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=8F=AF?=
=?UTF-8?q?=E9=80=89=E8=AE=B0=E5=BD=95pid?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
eladmin-system/src/main/java/me/zhengjie/AppRun.java | 7 ++++++-
eladmin-system/src/main/resources/config/application.yml | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/eladmin-system/src/main/java/me/zhengjie/AppRun.java b/eladmin-system/src/main/java/me/zhengjie/AppRun.java
index ed244064..f16bf975 100644
--- a/eladmin-system/src/main/java/me/zhengjie/AppRun.java
+++ b/eladmin-system/src/main/java/me/zhengjie/AppRun.java
@@ -20,6 +20,7 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping;
import me.zhengjie.utils.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
@@ -43,7 +44,11 @@ import org.springframework.web.bind.annotation.RestController;
public class AppRun {
public static void main(String[] args) {
- SpringApplication.run(AppRun.class, args);
+ SpringApplication springApplication = new SpringApplication(AppRun.class);
+ // 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/eladmin/app.pid
+ // 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/eladmin/app.pid`
+ springApplication.addListeners(new ApplicationPidFileWriter());
+ springApplication.run(args);
}
@Bean
diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml
index 8a3b228a..587785ab 100644
--- a/eladmin-system/src/main/resources/config/application.yml
+++ b/eladmin-system/src/main/resources/config/application.yml
@@ -12,6 +12,8 @@ spring:
redis:
repositories:
enabled: false
+# pid:
+# file: /自行指定位置/eladmin.pid
#配置 Jpa
jpa:
From 7e85fb2e25b3ffa270ceb410e7be43ceefaf976c Mon Sep 17 00:00:00 2001
From: Zheng Jie <201507802@qq.com>
Date: Fri, 18 Mar 2022 14:10:12 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B6=85=E5=87=BA?=
=?UTF-8?q?=E8=A7=84=E5=AE=9A=E5=A4=A7=E5=B0=8F=E6=8F=90=E7=A4=BA=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
index 3ac841d1..26830c54 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
@@ -253,7 +253,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M
int len = 1024 * 1024;
if (size > (maxSize * len)) {
- throw new BadRequestException("文件超出规定大小");
+ throw new BadRequestException("文件超出规定大小:" + maxSize + "M");
}
}
From 76ac60e9948e77b87cd4ad47a28af6a4f93f028b Mon Sep 17 00:00:00 2001
From: Zheng Jie <201507802@qq.com>
Date: Fri, 18 Mar 2022 14:33:19 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B6=85=E5=87=BA?=
=?UTF-8?q?=E8=A7=84=E5=AE=9A=E5=A4=A7=E5=B0=8F=E6=8F=90=E7=A4=BA=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
index 26830c54..0d8d5fb4 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
@@ -253,7 +253,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M
int len = 1024 * 1024;
if (size > (maxSize * len)) {
- throw new BadRequestException("文件超出规定大小:" + maxSize + "M");
+ throw new BadRequestException("文件超出规定大小:" + maxSize + "MB");
}
}
From acd8d8628c8acee4639bb83b5b2d25bf50429ccd Mon Sep 17 00:00:00 2001
From: Zheng Jie <201507802@qq.com>
Date: Tue, 22 Mar 2022 13:24:31 +0800
Subject: [PATCH 7/7] =?UTF-8?q?=E4=BD=93=E9=AA=8C=E5=9C=B0=E5=9D=80?=
=?UTF-8?q?=E6=9B=B4=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d345eea1..7462baca 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
**开发文档:** [https://el-admin.vip](https://el-admin.vip)
-**体验地址:** [https://el-admin.xin](https://el-admin.xin)
+**体验地址:** [https://el-admin.vip/demo](https://el-admin.vip/demo)
**账号密码:** `admin / 123456`