mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-07 09:29:08 +08:00
修改抛错导致无限循环问题
This commit is contained in:
parent
714e85fac0
commit
a998b96ff6
@ -35,7 +35,7 @@ public class CloopenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SmsResponse smsResponse(Map<String, Object> paramMap) {
|
public SmsResponse smsResponse(Map<String, Object> paramMap) {
|
||||||
try {
|
|
||||||
String timestamp = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
|
String timestamp = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
|
||||||
|
|
||||||
String url = String.format("%s/Accounts/%s/SMS/TemplateSMS?sig=%s",
|
String url = String.format("%s/Accounts/%s/SMS/TemplateSMS?sig=%s",
|
||||||
@ -46,15 +46,20 @@ public class CloopenHelper {
|
|||||||
headers.put("Accept", Constant.ACCEPT);
|
headers.put("Accept", Constant.ACCEPT);
|
||||||
headers.put("Content-Type", Constant.APPLICATION_JSON_UTF8);
|
headers.put("Content-Type", Constant.APPLICATION_JSON_UTF8);
|
||||||
headers.put("Authorization", this.generateAuthorization(config.getAccessKeyId(), timestamp));
|
headers.put("Authorization", this.generateAuthorization(config.getAccessKeyId(), timestamp));
|
||||||
SmsResponse smsResponse = getResponse(http.postJson(url, headers, paramMap));
|
SmsResponse smsResponse = null;
|
||||||
|
try {
|
||||||
|
smsResponse = getResponse(http.postJson(url, headers, paramMap));
|
||||||
|
} catch (SmsBlendException e) {
|
||||||
|
smsResponse = new SmsResponse();
|
||||||
|
smsResponse.setSuccess(false);
|
||||||
|
smsResponse.setData(e.getMessage());
|
||||||
|
}
|
||||||
if (smsResponse.isSuccess() || retry == config.getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry == config.getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
return requestRetry(paramMap);
|
return requestRetry(paramMap);
|
||||||
}catch (SmsBlendException e){
|
|
||||||
return requestRetry(paramMap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SmsResponse requestRetry(Map<String, Object> paramMap) {
|
private SmsResponse requestRetry(Map<String, Object> paramMap) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user