From 51aa069acd05c987de68c985ed3ef0ad936ce74f Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Mon, 28 May 2018 16:08:44 +0800 Subject: [PATCH] update --- .../core/impls/SimpleClientApplyServiceImpl.java | 14 ++++++++------ src/main/resources/application.properties | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) 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 c75c507ee..01404cb0a 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 @@ -58,9 +58,9 @@ import cn.yixblog.platform.http.HttpRequestResult; public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { - @Value("${royalpay.sms.appid}") + @Value("${royalpay.sms.appid:1400094878}") private int appId; - @Value("${royalpay.sms.appkey}") + @Value("${royalpay.sms.appkey:43390d81e20c5191c278fbf4cd275be2}") private String appKey; @Resource private SysConfigManager sysConfigManager; @@ -95,9 +95,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @Resource private StringRedisTemplate stringRedisTemplate; - private final SmsSingleSender ssender = new SmsSingleSender(appId, appKey); - // TODO: 2018/5/24 kira - private final int REGISTER_CLIENT_TEMPLID = 126008; + private SmsSingleSender sender = null; + private final int REGISTER_CLIENT_TEMPLID = 126978; 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"; @@ -106,6 +105,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @PostConstruct public void init() { tags.add("account"); + sender = new SmsSingleSender(appId, appKey); } @Override @@ -138,12 +138,14 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { JSONObject sysConfig = sysConfigManager.getSysConfig(); ArrayList param = new ArrayList<>(); String registerClientCode = RandomStringUtils.random(6, true, true); + param.add("RoyalPay"); param.add(registerClientCode); String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3); param.add(expireMin); try { - ssender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); // + sender.sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); } catch (Exception e) { + e.printStackTrace(); throw new ServerErrorException("Phone number is wrong Please try again"); } stringRedisTemplate.boundValueOps(getRegisterClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 490a6d3f3..456d70c5e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -109,5 +109,5 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au ############## ##短信key ############## -royalpay.sms.appid=1400035361 -royalpay.sms.appkey=d6e7cc6400ecd159963c1972cdb088cf +royalpay.sms.appid=1400094878 +royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2