Commit c4499914 by java-李谡

添加redis方法

parent 7815b27c
......@@ -8,5 +8,5 @@ redis.maxWaitMillis=10000
redis.testOnBorrow=true
redis.testOnReturn=true
redis.dbIndex=3
ipWithinSeconds=3600
ipLimitTimes=25
\ No newline at end of file
ipWithinSeconds=60
ipLimitTimes=10
\ No newline at end of file
......@@ -145,16 +145,17 @@ public class UserController {
LOG.debug("[UserController login][STATUS_CODE_4102]总共用时:" + Util.getDurationTime(duration));
return responseBean;
}
String blackUsername= redisUtils.get("black_username:" + loginBean.getLoginName(), indexDb);
if (null != redisUsername && Integer.parseInt(redisUsername) >= 5 && StringUtils.isEmpty(blackUsername) ) {
redisUtils.set("black_username:"+loginBean.getLoginName(), 1, indexDb);
}else if (blackUsername!=null && Integer.parseInt(blackUsername) ==1){
redisUtils.expire("black_username:"+loginBean.getLoginName(), 300, indexDb);
redisUtils.incrNotResetExpireTime("black_username:"+loginBean.getLoginName(), indexDb);
String blackUsername = redisUtils.get("black_username:" + loginBean.getLoginName(), indexDb);
boolean sealup = false;
if (null != redisUsername && Integer.parseInt(redisUsername) >= 5 && StringUtils.isEmpty(blackUsername)) {
redisUtils.set("black_username:" + loginBean.getLoginName(), 1, indexDb);
redisUtils.expire("black_username:" + loginBean.getLoginName(), 60, indexDb);
sealup = true;
} else if (blackUsername != null) {
sealup = true;
}
if (redisUtils.get("black_username:" + loginBean.getLoginName(), indexDb)!=null){
if (sealup) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4101);
responseBean.setMessage("该帐号已禁止登录");
checkIpLimit(userIp);
......@@ -167,7 +168,7 @@ public class UserController {
// 用户信息redis初始时间 增加value值
if (StringUtils.isEmpty(redisUsername)) {
redisUtils.set(loginBean.getLoginName(), 1, indexDb);
redisUtils.expire(loginBean.getLoginName(), 360, indexDb);
redisUtils.expire(loginBean.getLoginName(), 60, indexDb);
} else {
redisUtils.incrNotResetExpireTime(loginBean.getLoginName(), indexDb);
}
......@@ -216,7 +217,7 @@ public class UserController {
// 用户信息redis初始时间 增加value值
if (StringUtils.isEmpty(redisUsername)) {
redisUtils.set(loginBean.getLoginName(), 1, indexDb);
redisUtils.expire(loginBean.getLoginName(), 360, indexDb);
redisUtils.expire(loginBean.getLoginName(), 60, indexDb);
} else {
redisUtils.incrNotResetExpireTime(loginBean.getLoginName(), indexDb);
}
......@@ -749,7 +750,7 @@ public class UserController {
// deviceInfoEntity.setDeviceToken(loginBean.getDeviceToken());
// deviceInfoEntity.setPlatform(loginBean.getPlatform());
// deviceInfoEntity.setVersion(loginBean.getVersionName());
UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity();
deviceInfoEntity.setUserId(userEntity.getId());
deviceInfoEntity.setLoginDate(new Date());
......@@ -961,7 +962,7 @@ public class UserController {
if (message == null) {
String seatMobilePhone = "";
//修改允许席位手机号为空,如果为空,则修改席位手机号为用户手机号
if(StringUtils.isEmpty(loginBean.getSeatMobile())){
if (StringUtils.isEmpty(loginBean.getSeatMobile())) {
UserEntity userEntity = new UserEntity();
userEntity.setUsercode(loginBean.getUserId());
User user = userService.getUserByUserCode(userEntity);
......
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