处理短信问题

This commit is contained in:
wanggeng 2022-03-23 10:47:02 +08:00
parent c78b1b68c7
commit 0bee326f7b
2 changed files with 3 additions and 3 deletions

View File

@ -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("短信发送成功");

View File

@ -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);