nnnn
This commit is contained in:
@@ -7,6 +7,7 @@ import com.ruoyi.cai.mapper.IpBlackMapper;
|
||||
import com.ruoyi.cai.service.IpBlackService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class IpBlackServiceImpl extends ServiceImpl<IpBlackMapper,IpBlack> implements IpBlackService {
|
||||
|
||||
@Override
|
||||
@@ -26,6 +28,15 @@ public class IpBlackServiceImpl extends ServiceImpl<IpBlackMapper,IpBlack> imple
|
||||
return exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkIpThrowException(String clientIP){
|
||||
Boolean b = this.checkIp(clientIP);
|
||||
if(b){
|
||||
log.error("登录拦截了异常IP={}", clientIP);
|
||||
throw new ServiceException("40305");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveIp(IpBlack ipBlack){
|
||||
boolean exists = this.exists(Wrappers.lambdaQuery(IpBlack.class).eq(IpBlack::getIpAddr, ipBlack.getIpAddr()));
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2024-01-01
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SmsVerifyServiceImpl extends ServiceImpl<SmsVerifyMapper,SmsVerify> implements SmsVerifyService {
|
||||
|
||||
@Autowired
|
||||
@@ -85,28 +87,20 @@ public class SmsVerifyServiceImpl extends ServiceImpl<SmsVerifyMapper,SmsVerify>
|
||||
}
|
||||
}else if(codeEnum == CodeEnum.RESET_PASSWORD){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
MinUser miniUser = userService.getMinUserById(userId);
|
||||
if(miniUser == null || !mobile.equalsIgnoreCase(miniUser.getMobile())){
|
||||
log.error("手机号与登录手机号不一致");
|
||||
throw new ServiceException("手机号未注册!");
|
||||
}
|
||||
long count = userService.count(Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getMobile, mobile));
|
||||
if(count == 0){
|
||||
throw new ServiceException("手机号未注册!");
|
||||
}
|
||||
}else if(codeEnum == CodeEnum.RESET_ADOLESCENT){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
MinUser miniUser = userService.getMinUserById(userId);
|
||||
if(miniUser == null || !mobile.equalsIgnoreCase(miniUser.getMobile())){
|
||||
log.error("手机号与登录手机号不一致");
|
||||
throw new ServiceException("手机号未注册!");
|
||||
}
|
||||
long count = userService.count(Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getMobile, mobile));
|
||||
if(count == 0){
|
||||
throw new ServiceException("手机号未注册!");
|
||||
}
|
||||
throw new ServiceException("接口关闭,联系客服");
|
||||
// Long userId = LoginHelper.getUserId();
|
||||
// MinUser miniUser = userService.getMinUserById(userId);
|
||||
// long count = userService.count(Wrappers.lambdaQuery(User.class)
|
||||
// .eq(User::getMobile, mobile));
|
||||
// if(count == 0){
|
||||
// throw new ServiceException("手机号未注册!");
|
||||
// }
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
SmsVerify one = this.getOne(Wrappers.lambdaQuery(SmsVerify.class)
|
||||
|
||||
Reference in New Issue
Block a user