针对 iOS 审核修改

This commit is contained in:
GYJ
2025-01-13 11:39:34 +08:00
parent 7370f1adf0
commit 07aab2b577
4 changed files with 13 additions and 10 deletions

View File

@@ -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说明是第一次请求直接保存