| | |
| | | import com.yeshi.fanli.service.inter.user.SMSService;
|
| | | import com.yeshi.fanli.util.AliyunSMSUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TencentSMSUtil;
|
| | |
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | |
|
| | | String key = StringUtil.Md5("sms-login-tencent-latest-" + phone);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("sms-login-tencent-latest-" + phone));
|
| | |
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | | // 验证码模板
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void sendRemoveVCode(String phone, int codeLength) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_REMVOE);
|
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | |
|
| | | // 验证码模板
|
| | | String msg = Constant.smsConfig.getSmsBind().replace("[签名]", Constant.smsConfig.getSmsSign()).replace("[验证码]",
|
| | | msgCode);
|
| | | // 发送短信
|
| | | TencentSMSUtil.sendSingleMsg(phone, msg);
|
| | |
|
| | | // 缓存
|
| | | redisManager.sendSms(phone, SMSHistory.TYPE_REMVOE);
|
| | | redisManager.saveSMSVCode(phone, SMSHistory.TYPE_REMVOE, msgCode);
|
| | |
|
| | | SMSHistory smsHistory = new SMSHistory();
|
| | | smsHistory.setContent(msg);
|
| | | smsHistory.setCreateTime(new Date());
|
| | | smsHistory.setPhone(phone);
|
| | | smsHistory.setType(SMSHistory.TYPE_REMVOE);
|
| | | smsHistoryMapper.insertSelective(smsHistory);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void sendExtractVCode(String phone) throws SMSException {
|
| | | boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_EXTRACT);
|
| | | if (limit)
|