Commit 81d0f060 authored by lee_mingzhu's avatar lee_mingzhu

Merge branch 'xyqb-user2-msg2.0' of http://gitabc.xyqb.com/head_group/xyqb-user2

parents fb6e9e7a 2ea1f503
......@@ -235,7 +235,7 @@
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>quantgroup-sms-sdk</artifactId>
<version>1.0.5</version>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
......@@ -257,7 +257,7 @@
<dependency>
<groupId>cn.quantgroup</groupId>
<artifactId>quantgroup-sms-sdk</artifactId>
<version>1.0.5-SNAPSHOT</version>
<version>2.0.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......
package cn.quantgroup.xyqb.controller.internal.sms;
import cn.quantgroup.sms.ConfirmableMsg;
import cn.quantgroup.sms.MsgParams;
import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.aspect.captcha.CaptchaValidator;
import cn.quantgroup.xyqb.model.JsonResult;
......@@ -16,10 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
......@@ -105,11 +102,13 @@ public class SmsController {
String uniqueId = phoneNo + UUID.randomUUID().toString().replaceAll("-", "");
List<String> newList = new ArrayList<>();
newList.add(randomCode);
ConfirmableMsg confirmableMsg = new ConfirmableMsg(
/*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().sendConfirmableMessage(confirmableMsg);
smsService.getSmsSender().sendMsg(message);
redisTemplate.opsForValue().set(key, uniqueId + ":" + randomCode, EXPIRE_MINUTES, TimeUnit.MINUTES);
return JsonResult.buildSuccessResult("发送成功", uniqueId);
} catch (Exception e) {
......
package cn.quantgroup.xyqb.service.sms.impl;
import cn.quantgroup.sms.MsgParams;
import cn.quantgroup.sms.SendAndForgetMsg;
import cn.quantgroup.sms.SmsSender;
import cn.quantgroup.xyqb.Constants;
......@@ -47,7 +48,9 @@ public class SmsServiceImpl implements ISmsService {
@Override
public void sendAfterRegister(String phoneNo) {
try {
smsSender.sendAndForget(new SendAndForgetMsg(Collections.emptyList(), "24", "1", phoneNo));
MsgParams msgParams = new MsgParams(Collections.singletonList(2), phoneNo, "1", "24", Collections.emptyList());
smsSender.sendMsg(msgParams);
//smsSender.sendAndForget(new SendAndForgetMsg(Collections.emptyList(), "24", "1", phoneNo));
LOGGER.info("注册完成,发送短信, phoneNo:{}", phoneNo);
} catch (Exception e) {
e.printStackTrace();
......@@ -95,12 +98,17 @@ public class SmsServiceImpl implements ISmsService {
private boolean confirmSms(String smsVerificationCode, String unqiueId, String code) {
try {
MsgParams message = new MsgParams(Collections.singletonList(2), unqiueId);
//MsgParams messageVoice = new MsgParams(Collections.singletonList(4), unqiueId);
getSmsSender().confirmMsg(message);
//getSmsSender().confirmMsg(messageVoice);
//smsSender.confirmSmsResult("1", unqiueId);
LOGGER.info("confirmMsg send success, uniqueId={}", unqiueId);
} catch (Exception e) {
LOGGER.info("短信验证像短信中心确认失效");
}
if (StringUtils.equals(code, smsVerificationCode)) {
try {
smsSender.confirmSmsResult("1", unqiueId);
} catch (Exception e) {
LOGGER.info("短信验证像短信中心确认失效");
}
return true;
}
return false;
......
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