Commit 2bb62bff authored by 技术部-任文超's avatar 技术部-任文超

添加H5专用短信验证码获取接口

parent cd093954
......@@ -195,7 +195,7 @@ public class SmsController implements IBaseController {
*/
@CaptchaNewValidator
@RequestMapping("/send_login_code_voice_new")
public JsonResult sendLoginSmsCodeNew(@RequestParam String phoneNo, @RequestParam(required = false) String registerFrom,
public JsonResult sendLoginCodeVoiceNew(@RequestParam String phoneNo, @RequestParam(required = false) String registerFrom,
String usage, @RequestParam(required = false) String deviceId) {
if (StringUtils.isEmpty(usage) || !"6".equals(usage)) {
LOGGER.error("参数校验失败,用户登录语音验证码usage参数为{}", usage);
......@@ -211,15 +211,24 @@ public class SmsController implements IBaseController {
*/
@CaptchaNewValidator
@RequestMapping("/send_login_code_new")
public JsonResult sendLoginCodeVoiceNew(@RequestParam String phoneNo, @RequestParam(required = false) String registerFrom, @RequestParam(required = false) String deviceId) {
public JsonResult sendLoginSmsCodeNew(@RequestParam String phoneNo, @RequestParam(required = false) String registerFrom, @RequestParam(required = false) String deviceId) {
LOGGER.info("快速登陆-发送验证码, phoneNo:{}, registerFrom:{}", phoneNo, registerFrom);
return sendVerificationCode2New(phoneNo, deviceId);
return sendVerificationCode2New(phoneNo, deviceId, true);
}
/**
* 快速登陆发送短信验证码
*/
@CaptchaNewValidator
@RequestMapping("/send_login_code_new_forH5")
public JsonResult sendLoginSmsCodeNewForH5(@RequestParam String phoneNo, @RequestParam(required = false) String registerFrom, @RequestParam(required = false) String deviceId) {
LOGGER.info("快速登陆-发送验证码, phoneNo:{}, registerFrom:{}", phoneNo, registerFrom);
return sendVerificationCode2New(phoneNo, deviceId, false);
}
/**
* 新版本验证码
*/
private JsonResult sendVerificationCode2New(String phoneNo, String deviceId) {
private JsonResult sendVerificationCode2New(String phoneNo, String deviceId, boolean isApp) {
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
return JsonResult.buildErrorStateResult("手机号格式有误", null);
}
......@@ -232,13 +241,6 @@ public class SmsController implements IBaseController {
return JsonResult.buildErrorStateResult("今天已获取20次短信验证码,请使用语音验证码或明天再试", null);
}
String verificationIPCountKey = getIp();
//if (!StringUtils.isEmpty(verificationIPCountKey)) {
// verificationIPCountKey=Constants.REDIS_SMS_IP_COUNT+verificationIPCountKey;
// Long getIPVerificationCount = redisTemplate.opsForHash().increment(verificationIPCountKey, Constants.REDIS_SMS_IP_COUNT, 1);
// //if (getIPVerificationCount > IP_MAX_PER_DAY) {
// // return JsonResult.buildErrorStateResult("您当前ip已经达到获取今天验证码上限", null);
// //}
//}
LOGGER.info("请求短信新版本接口:phoneNo:{},deviceId:{},IP:{}",phoneNo,deviceId,getIp());
if (!StringUtils.isEmpty(deviceId)) {
String verificationDeviceCountKey = Constants.REDIS_SMS_DEVICE_COUNT + deviceId;
......@@ -260,16 +262,12 @@ public class SmsController implements IBaseController {
String uniqueId = phoneNo + UUID.randomUUID().toString().replaceAll("-", "");
List<String> newList = new ArrayList<>();
newList.add(randomCode);
/*ConfirmableMsg confirmableMsg = new ConfirmableMsg(
uniqueId, newList, "1", "1", phoneNo
);*/
MsgParams message = new MsgParams(Collections.singletonList(2), phoneNo, "1", "1", Collections.singletonList(randomCode), uniqueId);
try {
//smsService.getSmsSender().sendConfirmableMessage(confirmableMsg);
smsService.getSmsSender().sendMsg(message);
redisTemplate.opsForValue().set(key, uniqueId + ":" + randomCode, EXPIRE_MINUTES, TimeUnit.MINUTES);
deleteRetSendCode(phoneNo);//删除用户重置密码,多次错误逻辑
if(needImageVlidate(verificationIPCountKey,deviceId,phoneNo)){
if(isApp && needImageVlidate(verificationIPCountKey,deviceId,phoneNo)){
return JsonResult.buildSuccessResult("发送成功", uniqueId,0003L);
}
LOGGER.info("sendVerificationCode2New获取短信成功:phone:{},deviceId:{},ip:{}",phoneNo,deviceId,getIp());
......
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