|
|
@@ -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 { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |