针对 iOS 审核修改
This commit is contained in:
@@ -152,21 +152,22 @@ public class RedisServiceImpl implements RedisService {
|
||||
return expireTime == -1 ? second : expireTime > DateUtil.current(false) ? expireTime - DateUtil.current(false) : 0L;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkIpJumpLimit(long userId, String ip) {
|
||||
String userKey = "user:" + userId + ":last_ip"; // 存储用户上次的 IP 地址
|
||||
// 存储用户上次的 IP 地址
|
||||
String userKey = "user:" + userId + ":last_ip";
|
||||
String lastIp = redisTemplate.opsForValue().get(userKey);
|
||||
|
||||
// 获取用户跳动的历史 IP 地址集合
|
||||
String jumpHistoryKey = "user:" + userId + ":ip_history"; // 记录用户跳动过的 IP 地址
|
||||
String jumpHistoryKey = "user:" + userId + ":ip_history";
|
||||
Set<String> jumpHistory = redisTemplate.opsForSet().members(jumpHistoryKey);
|
||||
|
||||
// 记录 IP 跳动次数
|
||||
String ipTimestampKey = "user:" + userId + ":ip_timestamp"; // 记录每个 IP 跳动的过期时间
|
||||
String userJumpCountKey = "user:" + userId + ":jump_count"; // 用户跳动的总次数
|
||||
String ipTimestampKey = "user:" + userId + ":ip_timestamp";
|
||||
String userJumpCountKey = "user:" + userId + ":jump_count";
|
||||
|
||||
// 新增用于记录所有 IP 请求时间和次数的 Hash
|
||||
String ipRequestsKey = "user:" + userId + ":ip_requests"; // 用来记录 IP 的请求次数和时间
|
||||
String ipRequestsKey = "user:" + userId + ":ip_requests";
|
||||
|
||||
|
||||
// 如果用户之前没有记录过 IP,说明是第一次请求,直接保存
|
||||
|
||||
Reference in New Issue
Block a user