ip隔离-判断是否已被限制
This commit is contained in:
@@ -19,7 +19,7 @@ public class IpRegionLimitRecordService extends ServiceImpl<IpRegionLimitRecordM
|
||||
public boolean isInLimitRecord(Long uid, String ip, String ipRegion, String deviceId) {
|
||||
IpRegionLimitRecord record = getById(uid);
|
||||
if (null == record){
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
record.setLastCheckIp(ip);
|
||||
record.setLastCheckIpRegion(ipRegion);
|
||||
@@ -33,7 +33,7 @@ public class IpRegionLimitRecordService extends ServiceImpl<IpRegionLimitRecordM
|
||||
}
|
||||
record.setDeviceIds(deviceIds);
|
||||
SpringContextHolder.getBean(IpRegionLimitRecordService.class).update(record);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Async
|
||||
|
@@ -35,7 +35,7 @@ public class IpRegionService {
|
||||
public Long check(Long uid, String ip, DeviceInfo deviceInfo) {
|
||||
String ipRegion = regionService.getRegion(ip);
|
||||
|
||||
if (!recordService.isInLimitRecord(uid, ip, ipRegion, deviceInfo.getDeviceId())){
|
||||
if (recordService.isInLimitRecord(uid, ip, ipRegion, deviceInfo.getDeviceId())){
|
||||
log.error("[ipRegionCheck] 被拦截,已在限制访问记录中 uid {} ip {} ipRegion {} deviceId {} mcc {} lang {}",
|
||||
uid, ip, ipRegion, deviceInfo.getDeviceId(), deviceInfo.getMcc(), deviceInfo.getLang());
|
||||
throw new ServiceException(BusiStatus.IP_REGION_HAD_LIMIT);
|
||||
|
Reference in New Issue
Block a user