diff --git a/cloud-manager-sms/src/main/java/com/cm/manager/sms/config/properties/SmsDefaultProperties.java b/cloud-manager-sms/src/main/java/com/cm/manager/sms/config/properties/SmsDefaultProperties.java index ac77392..e649f70 100644 --- a/cloud-manager-sms/src/main/java/com/cm/manager/sms/config/properties/SmsDefaultProperties.java +++ b/cloud-manager-sms/src/main/java/com/cm/manager/sms/config/properties/SmsDefaultProperties.java @@ -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 + + '}'; } } diff --git a/cloud-manager-sms/src/main/java/com/cm/manager/sms/service/impl/SmsServiceImpl.java b/cloud-manager-sms/src/main/java/com/cm/manager/sms/service/impl/SmsServiceImpl.java index 72018dd..d86d176 100644 --- a/cloud-manager-sms/src/main/java/com/cm/manager/sms/service/impl/SmsServiceImpl.java +++ b/cloud-manager-sms/src/main/java/com/cm/manager/sms/service/impl/SmsServiceImpl.java @@ -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(),