master
wangning 7 years ago
parent 3f03b2aa18
commit 45c8e9248c

@ -136,7 +136,11 @@
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<dependency>
<groupId>com.github.qcloudsms</groupId>
<artifactId>qcloudsms</artifactId>
<version>1.0.3</version>
</dependency>
<!--jpush start -->
<dependency>
<groupId>cn.jpush.api</groupId>

@ -12,10 +12,9 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.mail.SendMail;
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSender;
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSenderResult;
import com.alibaba.fastjson.JSONObject;
import com.github.qcloudsms.SmsSingleSender;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
@ -55,9 +54,9 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource
private StringRedisTemplate stringRedisTemplate;
private final SmsSingleSender smsSingleSender = new SmsSingleSender(appId, appKey);
// private final int REGISTER_CLIENT_TEMPLID = 126008;//正式
private final int REGISTER_CLIENT_TEMPLID = 110449;
private final SmsSingleSender ssender = new SmsSingleSender(appId, appKey);
// TODO: 2018/5/24 kira
private final int REGISTER_CLIENT_TEMPLID = 126008;
private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT";
private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS";
private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL";
@ -95,7 +94,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
if (StringUtils.isNotEmpty(value)) {
throw new BadRequestException("SMS has been sentPlease check your messages or try again in 3 minutes.");
}
JSONObject sysConfig = sysConfigManager.getSysConfig();
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, true, true);
@ -103,10 +101,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3);
param.add(expireMin);
try {
SmsSingleSenderResult result = smsSingleSender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "", "", "");
System.out.println(result);
System.out.println(result);
System.out.println(result);
ssender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); //
} catch (Exception e) {
throw new ServerErrorException("System Error");
}

@ -28,34 +28,12 @@ public class SimpleClientApplyServiceImplTest {
@Test
public void partnerSignIn() {
simpleClientApplyService.partnerSignIn(null);
}
@Test
public void getAndSendSmsCode() {
String phone = "17626011667";
String nationCode = "+86";
String code = simpleClientApplyService.getAndSendSmsCode(phone, nationCode);
System.out.println(code);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
try {
simpleClientApplyService.getAndSendSmsCode(phone, nationCode);
} catch (Exception e) {
System.out.println("之前应当报错,短信已经发送");
}
simpleClientApplyService.verifyRegisterSMSCode(code, phone);
try {
simpleClientApplyService.verifyRegisterSMSCode(code, phone);
System.out.println(code);
} catch (Exception e) {
System.out.println("报错 无法验证");
}
simpleClientApplyService.getAndSendSmsCode("0451120326","61");
}
@Test

Loading…
Cancel
Save