处理短信问题
This commit is contained in:
parent
c78b1b68c7
commit
0bee326f7b
@ -23,7 +23,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
public class DefaultSmsSendImpl implements ISmsSend {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultSmsSendImpl.class);
|
||||
private static final String URL_SMS = "{url}?action=send&userid=&account={account}&password={password}&mobile={mobile}&content={content}&sendTime=&extno={extno}";
|
||||
private static final String URL_SMS = "?action=send&userid=&account={account}&password={password}&mobile={mobile}&content={content}&sendTime=&extno={extno}";
|
||||
private SmsDefaultProperties smsDefaultProperties;
|
||||
|
||||
public DefaultSmsSendImpl(SmsDefaultProperties smsDefaultProperties) {
|
||||
@ -50,7 +50,6 @@ public class DefaultSmsSendImpl implements ISmsSend {
|
||||
*/
|
||||
private void send(String phone, String content) {
|
||||
String[] paramArray = new String[]{
|
||||
smsDefaultProperties.getUrl(),
|
||||
smsDefaultProperties.getAccount(),
|
||||
smsDefaultProperties.getPassword(),
|
||||
phone,
|
||||
@ -58,7 +57,7 @@ public class DefaultSmsSendImpl implements ISmsSend {
|
||||
phone
|
||||
};
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String result = restTemplate.getForObject(URL_SMS, String.class, paramArray);
|
||||
String result = restTemplate.getForObject(smsDefaultProperties.getUrl() + URL_SMS, String.class, paramArray);
|
||||
JSONObject jsonObject = XML.toJSONObject(result);
|
||||
if (StringUtils.equals("Success", jsonObject.getJSONObject("returnsms").getString("returnstatus"))) {
|
||||
LOG.info("短信发送成功");
|
||||
|
@ -146,6 +146,7 @@ public class SmsServiceImpl extends DefaultBaseService implements ISmsService {
|
||||
verifyCodeManager.setVerificationCode(phone, code);
|
||||
smsVO.setSendStatus(1);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
String errorMessage = e.getMessage();
|
||||
smsVO.setSendStatus(0);
|
||||
smsVO.setErrorMessage(errorMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user