瀏覽代碼

修改短信发送异常处理

tags/V1.7.0
wanghaoran 1 年之前
父節點
當前提交
9016929a73
共有 1 個文件被更改,包括 5 次插入1 次删除
  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 查看文件

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.HttpUtils;
import com.tuoheng.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
@@ -32,6 +33,10 @@ public class SmsUtil {
String dspSmsUrl = CommonConfig.dspDomainUrl + "/api/web/sms/sendSyncSms";
//发送http请求
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);
if(0 != resultJson.getIntValue("code")){
log.error("发送短信接口响应失败:"+result);
@@ -40,5 +45,4 @@ public class SmsUtil {

}


}

Loading…
取消
儲存