修改

parent cd2e521d
......@@ -88,7 +88,7 @@ public class CaptchaNewValidateAdvisor {
Long countIP = countIP(clientIp);
Long countPhone = countPhone(phoneNo);
Long countDeviceId = countDeviceId(deviceId);
LOGGER.info("使用图形验证码, registerFrom={}, clientIp={},手机号次数:{},设备次数:{},ip次数:{}", registerFrom, request.getRemoteAddr(),countIP,countDeviceId,countIP);
if (countIP > Constants.Image_Need_Count || countPhone > Constants.Image_Need_Count || countDeviceId > Constants.Image_Need_Count) {
if (shouldSkipCaptchaValidate(registerFrom, captchaId, captchaValue)) {
......@@ -115,6 +115,7 @@ public class CaptchaNewValidateAdvisor {
}
return result;
}
LOGGER.info("使用图形验证码校验不正确, registerFrom={}, clientIp={},手机号次数:{},设备次数:{},ip次数:{}", registerFrom, request.getRemoteAddr(),countIP,countDeviceId,countIP);
result.setMsg("请输入图形验证码");
return result;
......
......@@ -153,6 +153,7 @@ public class SmsController implements IBaseController {
smsService.getSmsSender().sendMsg(message);
redisTemplate.opsForValue().set(key, uniqueId + ":" + randomCode, EXPIRE_MINUTES, TimeUnit.MINUTES);
deleteRetSendCode(phoneNo);//删除用户重置密码,多次错误逻辑
return JsonResult.buildSuccessResult("发送成功", uniqueId);
} catch (Exception e) {
LOGGER.error("发送短信验证码失败");
......@@ -228,6 +229,7 @@ public class SmsController implements IBaseController {
redisTemplate.expire(verificationPhoneCountKey, Constants.ONE_DAY,TimeUnit.SECONDS);
if (getPhoneVerificationCount > PHONE_MAX_PER_DAY) {
LOGGER.info("您手机号已经达到获取今天短信验证码上限:phoneNo:{},deviceId:{},ip:{}",phoneNo,deviceId,getIp());
return JsonResult.buildErrorStateResult("今天已获取20次短信验证码,请使用语音验证码或明天再试", null);
}
String verificationIPCountKey = getIp();
......@@ -238,12 +240,13 @@ public class SmsController implements IBaseController {
// // return JsonResult.buildErrorStateResult("您当前ip已经达到获取今天验证码上限", null);
// //}
//}
LOGGER.info("请求短信新版本接口:phoneNo:{},deviceId,IP{}",phoneNo,deviceId,getIp());
if (!StringUtils.isEmpty(deviceId)) {
String verificationDeviceCountKey = Constants.REDIS_SMS_DEVICE_COUNT + deviceId;
Long getDeviceVerificationCount = redisTemplate.opsForHash().increment(verificationDeviceCountKey, Constants.REDIS_SMS_DEVICE_COUNT, 1);
redisTemplate.expire(verificationDeviceCountKey, Constants.ONE_DAY,TimeUnit.SECONDS);
if (getDeviceVerificationCount > DEVICE_MAX_PER_DAY) {
LOGGER.info("您设备已经达到获取今天短信验证码上限:phoneNo:{},deviceId:{},ip:{}",phoneNo,verificationDeviceCountKey,getIp());
return JsonResult.buildErrorStateResult("您设备已经达到获取今天短信验证码上限", null);
}
}
......@@ -251,6 +254,7 @@ public class SmsController implements IBaseController {
String key = Constants.REDIS_PREFIX_VERIFICATION_CODE + phoneNo;
long expire = redisTemplate.getExpire(key, TimeUnit.MINUTES);
if (expire >= EXPIRE_MINUTES - 1) {
LOGGER.info("sendVerificationCode2New一分钟内重复获取:phoneNo:{},deviceId:{},ip:{}",phoneNo,deviceId,getIp());
return JsonResult.buildSuccessResult("发送成功", null);
}
String randomCode = smsIsDebug ? "0000" : String.valueOf(random.nextInt(8999) + 1000);
......@@ -269,9 +273,10 @@ public class SmsController implements IBaseController {
if(needImageVlidate(verificationIPCountKey,deviceId,phoneNo)){
return JsonResult.buildSuccessResult("发送成功", uniqueId,0003L);
}
LOGGER.info("sendVerificationCode2New获取短信成功:phone:{},deviceId:{},ip:{}",phoneNo,deviceId,getIp());
return JsonResult.buildSuccessResult("发送成功", uniqueId);
} catch (Exception e) {
LOGGER.error("发送短信验证码失败");
LOGGER.error("发送短信验证码失败:phone:{},deviceId:{},ip:{}",phoneNo,deviceId,getIp());
return JsonResult.buildErrorStateResult("发送失败", null);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment