diff --git a/bin/update.sh b/bin/update.sh index ae8d533..c733cbd 100644 --- a/bin/update.sh +++ b/bin/update.sh @@ -2,7 +2,7 @@ _pwd=/mnt/demo26.ydool.net _ip=119.3.109.134 cd ../ -mvn clean package +#mvn clean package scp target/build/*.jar root@${_ip}:${_pwd} #scp target/build/lib/*.* root@${_ip}:${_pwd}/lib ssh root@${_ip} "cd ${_pwd}; sh ./start.sh" \ No newline at end of file diff --git a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java index 3bbdd78..f54e455 100644 --- a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java @@ -77,14 +77,14 @@ public class AuthServiceImpl extends BaseService implements IA if (!captcha.equalsIgnoreCase(captchaCache)) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("验证码错误"); @@ -103,14 +103,14 @@ public class AuthServiceImpl extends BaseService implements IA if (ObjectUtil.isNull(loginUser)) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("账号或者密码错误"); @@ -121,14 +121,14 @@ public class AuthServiceImpl extends BaseService implements IA if (!loginPassword.equals(loginUser.getPassword())) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("账号或者密码错误"); @@ -137,14 +137,14 @@ public class AuthServiceImpl extends BaseService implements IA if (!loginUser.getStatus()) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("当前账号已被停用,请联系管理员"); @@ -154,14 +154,14 @@ public class AuthServiceImpl extends BaseService implements IA if (StrUtil.isBlank(loginUser.getRoles())) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("该用户没有对应的角色,无法登陆系统"); @@ -170,14 +170,14 @@ public class AuthServiceImpl extends BaseService implements IA List roleList = userService.roleListByUser(loginUser.getId()); if (CollUtil.isEmpty(roleList)) { //获取IP失败次数 String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip); - Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ; + Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ; if (ObjectUtil.isNull(failCount)) { failCount = 1; } else { failCount++; } + redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); if (failCount >= 5) { - redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES); redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES); } return AjaxResult.fail("该用户没有对应的角色或角色已被删除或禁用,无法登陆系统");