Merge remote-tracking branch 'origin/clientApply' into clientApply

master
yuan 7 years ago
commit 2ba51365ec

@ -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
@ -137,13 +137,15 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
JSONObject sysConfig = sysConfigManager.getSysConfig();
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, true, true);
String registerClientCode = RandomStringUtils.random(6, false, 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);
@ -418,5 +420,4 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private String getVerifyMailRedisKey(String codekey) {
return VERIFY_MAIL_PREFIX + codekey;
}
}

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