Browse Source

修改短信发送异常处理

tags/V1.7.0
wanghaoran 1 year ago
parent
commit
9016929a73
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/utils/SmsUtil.java

+ 5
- 1
tuoheng-api/src/main/java/com/tuoheng/api/utils/SmsUtil.java View File

import com.tuoheng.common.config.CommonConfig; import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException; import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.HttpUtils; import com.tuoheng.common.utils.HttpUtils;
import com.tuoheng.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
String dspSmsUrl = CommonConfig.dspDomainUrl + "/api/web/sms/sendSyncSms"; String dspSmsUrl = CommonConfig.dspDomainUrl + "/api/web/sms/sendSyncSms";
//发送http请求 //发送http请求
String result = HttpUtils.doSend(dspSmsUrl, jsonObject, null,"POST"); String result = HttpUtils.doSend(dspSmsUrl, jsonObject, null,"POST");
if(StringUtils.isEmpty(result)){
log.error("发送短信接口响应空:"+result);
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "短信发送失败");
}
JSONObject resultJson = JSONObject.parseObject(result); JSONObject resultJson = JSONObject.parseObject(result);
if(0 != resultJson.getIntValue("code")){ if(0 != resultJson.getIntValue("code")){
log.error("发送短信接口响应失败:"+result); log.error("发送短信接口响应失败:"+result);


} }



} }

Loading…
Cancel
Save