验证码限制次数
This commit is contained in:
parent
6773c10fa5
commit
0622e86cbf
|
|
@ -32,8 +32,13 @@ public class CommonServiceImpl implements CommonService {
|
|||
if (StrUtil.isBlank(sysUser.getPhone())) {
|
||||
throw new ApiNotPrintException("账号未绑定手机号");
|
||||
}
|
||||
String key = RedisCst.SMS_CODE + sysUser.getPhone() + ":" + type;
|
||||
Object val = redisService.get(key);
|
||||
if (val != null) {
|
||||
throw new ApiNotPrintException("请勿频繁获取");
|
||||
}
|
||||
int code = RandomUtil.randomInt(100000, 1000000);
|
||||
redisService.set(RedisCst.SMS_CODE + sysUser.getPhone() + ":" + type, code, 300);
|
||||
redisService.set(key, code, 300);
|
||||
smsService.sendCode(sysUser.getPhone(), String.valueOf(code));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||
}
|
||||
|
||||
shopInfo.setOperationPwd(SecureUtil.md5(shopInfoEditDTO.getOperationPwd()));
|
||||
redisService.del(key);
|
||||
}
|
||||
return updateById(shopInfo);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue