master
wangning 7 years ago
parent 2d8f06c845
commit 51aa069acd

@ -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<String> 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);

@ -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

Loading…
Cancel
Save