短信接口增加配置
This commit is contained in:
parent
63bef098c5
commit
a56090a64c
@ -1,5 +1,7 @@
|
||||
package com.cm.manager.sms.config.properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -12,11 +14,20 @@ package com.cm.manager.sms.config.properties;
|
||||
**/
|
||||
public class SmsDefaultProperties {
|
||||
|
||||
private String url;
|
||||
private String account;
|
||||
private String password;
|
||||
private String sign;
|
||||
private SmsDefaultTemplateProperties template;
|
||||
|
||||
public String getUrl() {
|
||||
return StringUtils.isBlank(url) ? "https://dx.ipyy.net/sms.aspx" : url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account == null ? "" : account.trim();
|
||||
}
|
||||
@ -51,16 +62,12 @@ public class SmsDefaultProperties {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"account\":")
|
||||
.append("\"").append(account).append("\"");
|
||||
sb.append(",\"password\":")
|
||||
.append("\"").append(password).append("\"");
|
||||
sb.append(",\"sign\":")
|
||||
.append("\"").append(sign).append("\"");
|
||||
sb.append(",\"template\":")
|
||||
.append(template);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
return "SmsDefaultProperties{" +
|
||||
"url='" + url + '\'' +
|
||||
", account='" + account + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", sign='" + sign + '\'' +
|
||||
", template=" + template +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public class SmsServiceImpl extends AbstractService implements ISmsService {
|
||||
private void defaultSmsCode(String phone, String code) throws Exception {
|
||||
SmsDefaultProperties smsDefaultProperties = smsProperties.getDefaultSms();
|
||||
String content = smsDefaultProperties.getTemplate().getVerificationCode().replace("{sign}", smsDefaultProperties.getSign()).replace("{content}", code);
|
||||
String url = "https://dx.ipyy.net/sms.aspx?action=send&userid=&account={account}&password={password}&mobile={mobile}&content={content}&sendTime=&extno={extno}";
|
||||
String url = smsDefaultProperties.getUrl() + "?action=send&userid=&account={account}&password={password}&mobile={mobile}&content={content}&sendTime=&extno={extno}";
|
||||
String[] paramArray = new String[]{
|
||||
smsDefaultProperties.getAccount(),
|
||||
smsDefaultProperties.getPassword(),
|
||||
|
Loading…
Reference in New Issue
Block a user