|
@ -33,17 +33,22 @@ public class SmsCodeServiceImpl extends ServiceImpl<SmsCodeDao, SmsCodeEntity> i
|
33
|
33
|
smsCodeEntity.setCode(code);
|
34
|
34
|
smsCodeEntity.setExpireTime(DateUtils.addDateMinutes(new Date(), ConfigConstant.EXPIRE_TIME));
|
35
|
35
|
|
36
|
|
// 发送验证码
|
37
|
|
StringBuilder sb = new StringBuilder();
|
38
|
|
sb.append("accountSid").append("=").append(ConfigConstant.ACCOUNT_SID);
|
39
|
|
sb.append("&to").append("=").append(phone);
|
40
|
|
sb.append("¶m").append("=").append(URLEncoder.encode(code + "," + ConfigConstant.EXPIRE_TIME, "UTF-8"));
|
41
|
|
sb.append("&templateid").append("=").append(ConfigConstant.TEMPLATE_ID);
|
42
|
|
String body = sb.toString() + HttpRequestUtil.createCommonParam(ConfigConstant.ACCOUNT_SID, ConfigConstant.AUTH_TOKEN);
|
43
|
|
String result = HttpRequestUtil.post(ConfigConstant.BASE_URL, body);
|
44
|
|
System.out.println(result);
|
45
|
|
|
46
|
|
this.save(smsCodeEntity);
|
|
36
|
String result = "";
|
|
37
|
try {
|
|
38
|
this.save(smsCodeEntity);
|
|
39
|
// 发送验证码
|
|
40
|
StringBuilder sb = new StringBuilder();
|
|
41
|
sb.append("accountSid").append("=").append(ConfigConstant.ACCOUNT_SID);
|
|
42
|
sb.append("&to").append("=").append(phone);
|
|
43
|
sb.append("¶m").append("=").append(URLEncoder.encode(code + "," + ConfigConstant.EXPIRE_TIME, "UTF-8"));
|
|
44
|
sb.append("&templateid").append("=").append(ConfigConstant.TEMPLATE_ID);
|
|
45
|
String body = sb.toString() + HttpRequestUtil.createCommonParam(ConfigConstant.ACCOUNT_SID, ConfigConstant.AUTH_TOKEN);
|
|
46
|
result = HttpRequestUtil.post(ConfigConstant.BASE_URL, body);
|
|
47
|
System.out.println(result);
|
|
48
|
} catch (Exception e) {
|
|
49
|
e.printStackTrace();
|
|
50
|
result = "数据库存在相同记录";
|
|
51
|
}
|
47
|
52
|
return result;
|
48
|
53
|
}
|
49
|
54
|
|