From 45c8e9248ca57aed92ed37ab20da782136a891ca Mon Sep 17 00:00:00 2001
From: wangning <164851225@qq.com>
Date: Thu, 24 May 2018 17:49:24 +0800
Subject: [PATCH] update
---
pom.xml | 6 ++++-
.../impls/SimpleClientApplyServiceImpl.java | 15 ++++-------
.../SimpleClientApplyServiceImplTest.java | 26 ++-----------------
3 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/pom.xml b/pom.xml
index d2d370dfe..c7dd78e36 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,7 +136,11 @@
com.alibaba
druid
-
+
+ com.github.qcloudsms
+ qcloudsms
+ 1.0.3
+
cn.jpush.api
diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java
index 553138a34..75de65512 100644
--- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java
@@ -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 sent,Please check your messages or try again in 3 minutes.");
}
-
JSONObject sysConfig = sysConfigManager.getSysConfig();
ArrayList 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");
}
diff --git a/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java
index 71dd9d432..e8aca7c16 100644
--- a/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java
+++ b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java
@@ -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