针对 iOS 审核修改
This commit is contained in:
parent
7370f1adf0
commit
07aab2b577
|
|
@ -201,6 +201,7 @@ public class AppController {
|
|||
if (count > 0) {
|
||||
UserEntity userEntity = userService.getById(userId);
|
||||
userEntity.setStatus(0);
|
||||
userEntity.setPlatform("异常行为用户:实名信息异常 在黑名单");
|
||||
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
log.warn("异常行为用户:实名信息异常: {}", userId);
|
||||
return Result.error("异常行为: 您的实名信息存在异常行为");
|
||||
|
|
|
|||
|
|
@ -89,9 +89,10 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
|||
long userId = Long.parseLong(claims.getSubject());
|
||||
request.setAttribute(USER_KEY, userId);
|
||||
|
||||
String ip = IPUtils.getIpAddr(request); // 获取用户的 IP 地址
|
||||
// 获取用户的 IP 地址
|
||||
String ip = IPUtils.getIpAddr(request);
|
||||
// 检查用户是否超过限流
|
||||
if (redisService.checkIpJumpLimit(userId, ip)) {
|
||||
if (redisService.checkIpJumpLimit(userId, ip) && userId != 14234L && userId != 1074096240846845557L) {
|
||||
log.warn("用户地址跳动频繁,封禁: {}", userId);
|
||||
if (!redisService.isSetUserState(userId)) {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
|
|
|
|||
|
|
@ -534,8 +534,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setMoney(orders.getPayDiamond());
|
||||
userMoneyDetails.setUserId(orders.getUserId());
|
||||
userMoneyDetails.setContent("金币支付订单");
|
||||
userMoneyDetails.setTitle("下单成功,订单号:" + orders.getOrdersNo());
|
||||
userMoneyDetails.setContent("金币解锁视频");
|
||||
userMoneyDetails.setTitle("解锁成功,订单号:" + orders.getOrdersNo());
|
||||
userMoneyDetails.setType(2);
|
||||
// ✅
|
||||
userMoneyDetails.setClassify(3);
|
||||
|
|
|
|||
|
|
@ -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,说明是第一次请求,直接保存
|
||||
|
|
|
|||
Loading…
Reference in New Issue