mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-07-24 02:09:35 +08:00
fixed: conflict
This commit is contained in:
parent
a23155cb27
commit
e554c01c7b
@ -63,7 +63,7 @@ public class LoginController {
|
|||||||
String limitKey = "admin-login-limit:" + loginRequest.getEmail();
|
String limitKey = "admin-login-limit:" + loginRequest.getEmail();
|
||||||
Long reqCount = rateLimiterService.current(limitKey, 3600L);
|
Long reqCount = rateLimiterService.current(limitKey, 3600L);
|
||||||
if (reqCount > 5) {
|
if (reqCount > 5) {
|
||||||
Long exp = RedisUtil.ttl(limitKey);
|
Long exp = RedisUtil.ttlWithoutPrefix(limitKey);
|
||||||
return JsonResponse.error(
|
return JsonResponse.error(
|
||||||
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class LoginController {
|
|||||||
String limitKey = "login-limit:" + req.getEmail();
|
String limitKey = "login-limit:" + req.getEmail();
|
||||||
Long reqCount = rateLimiterService.current(limitKey, 600L);
|
Long reqCount = rateLimiterService.current(limitKey, 600L);
|
||||||
if (reqCount >= 10) {
|
if (reqCount >= 10) {
|
||||||
Long exp = RedisUtil.ttl(limitKey);
|
Long exp = RedisUtil.ttlWithoutPrefix(limitKey);
|
||||||
return JsonResponse.error(
|
return JsonResponse.error(
|
||||||
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,10 @@ public class RedisUtil {
|
|||||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long ttlWithoutPrefix(String key) {
|
||||||
|
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据key获取过期时间
|
* 根据key获取过期时间
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user