Explorar o código

feature 增加时间

xiahan hai 3 semanas
pai
achega
3c94fb3a95

+ 4 - 4
qhse-common/src/main/java/com/rongwei/bscommon/system/service/impl/QHSELoginServiceImpl.java

@@ -63,8 +63,8 @@ public class QHSELoginServiceImpl implements QHSELoginService {
         if (redisService.hasKey(smsErrorKey)) {
             errorNum = Integer.parseInt(redisService.getRedisCatchObj(smsErrorKey).toString());
         }
-        if (errorNum > 10) {
-            log.error("用户:{},密码错误次数为:{}", username, errorNum + 1);
+        if (errorNum >= 10) {
+            log.error("用户:{},密码错误次数为:{}", username, errorNum);
             long expireTime = redisService.getExpireTime(smsErrorKey);
             throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
         }
@@ -94,13 +94,13 @@ public class QHSELoginServiceImpl implements QHSELoginService {
                 // 防止过期时间更新 只更新value
                 redisService.updateValueNoUpdateExpireTime(smsErrorKey, errorNum);
             }
-
             if (errorNum >= 10) {
                 log.error("用户:{},密码错误次数为:{}", username, errorNum);
                 long expireTime = redisService.getExpireTime(smsErrorKey);
                 throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
+            }else{
+                throw new RuntimeException("密码错误!请30秒后后再试");
             }
-            throw new RuntimeException("密码错误");
         }
         // 生成6位数验证码
         int smsCode = generateSms();