|
|
@@ -183,6 +183,18 @@ public class TokenController {
|
|
|
String code = RandomUtil.randomNumbers(6);
|
|
|
redisTemplate.opsForValue().set(key,code,CODE_EXPIRATION,TimeUnit.MINUTES);
|
|
|
logger.info("========================>{}<=========================",code);
|
|
|
+ String countKey=Constants.DEFAULT_CODE_KEY + "@" + username+"_COUNT";
|
|
|
+ String count = redisTemplate.opsForValue().get(countKey);
|
|
|
+ if (StringUtils.isEmpty(count)){
|
|
|
+ redisTemplate.opsForValue().set(countKey,"1",60,TimeUnit.MINUTES);
|
|
|
+ }else {
|
|
|
+ int i=Integer.parseInt(count);
|
|
|
+ if (i>=5){
|
|
|
+ throw new ServiceException("验证码发送超过限制,请一小时后再试",530);
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ redisTemplate.opsForValue().set(countKey,i+"",60,TimeUnit.MINUTES);
|
|
|
+ }
|
|
|
return R.ok(code);
|
|
|
// return stockService.sendSydSms(code, 2, null, form.getUsername());
|
|
|
}
|
|
|
@@ -227,7 +239,7 @@ public class TokenController {
|
|
|
if (R.FAIL == user.getCode()) {
|
|
|
throw new ServiceException(user.getMsg());
|
|
|
}
|
|
|
- if (StringUtils.isNull(user) || StringUtils.isNull(user.getData())) {
|
|
|
+ if (StringUtils.isNull(user.getData())) {
|
|
|
return R.fail("登录用户不存在!");
|
|
|
}
|
|
|
|