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 { public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Value("${royalpay.sms.appid}") @Value("${royalpay.sms.appid:1400094878}")
private int appId; private int appId;
@Value("${royalpay.sms.appkey}") @Value("${royalpay.sms.appkey:43390d81e20c5191c278fbf4cd275be2}")
private String appKey; private String appKey;
@Resource @Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@ -95,9 +95,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource @Resource
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
private final SmsSingleSender ssender = new SmsSingleSender(appId, appKey); private SmsSingleSender sender = null;
// TODO: 2018/5/24 kira private final int REGISTER_CLIENT_TEMPLID = 126978;
private final int REGISTER_CLIENT_TEMPLID = 126008;
private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT"; private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT";
private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS"; private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS";
private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL"; private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL";
@ -106,6 +105,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@PostConstruct @PostConstruct
public void init() { public void init() {
tags.add("account"); tags.add("account");
sender = new SmsSingleSender(appId, appKey);
} }
@Override @Override
@ -137,13 +137,15 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
} }
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();
ArrayList<String> param = new ArrayList<>(); 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); param.add(registerClientCode);
String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3); String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3);
param.add(expireMin); param.add(expireMin);
try { try {
ssender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); // sender.sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again"); throw new ServerErrorException("Phone number is wrong Please try again");
} }
stringRedisTemplate.boundValueOps(getRegisterClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES); 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) { private String getVerifyMailRedisKey(String codekey) {
return VERIFY_MAIL_PREFIX + codekey; return VERIFY_MAIL_PREFIX + codekey;
} }
} }

@ -109,5 +109,5 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au
############## ##############
##短信key ##短信key
############## ##############
royalpay.sms.appid=1400035361 royalpay.sms.appid=1400094878
royalpay.sms.appkey=d6e7cc6400ecd159963c1972cdb088cf royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2

Loading…
Cancel
Save