mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-06 08:58:38 +08:00
修复,异常状态下 短信重试无限次重试问题,布丁云短信群发采用自实现
This commit is contained in:
parent
a62bca40b6
commit
09a3dba016
@ -116,7 +116,7 @@ public class AlibabaSmsImpl extends AbstractSmsBlend<AlibabaConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.dromara.sms4j.comm.delayedTime.DelayedTime;
|
|||||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||||
import org.dromara.sms4j.provider.service.AbstractSmsBlend;
|
import org.dromara.sms4j.provider.service.AbstractSmsBlend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -72,7 +73,7 @@ public class BudingV2SmsImpl extends AbstractSmsBlend<BudingV2Config> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
@ -150,7 +151,12 @@ public class BudingV2SmsImpl extends AbstractSmsBlend<BudingV2Config> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SmsResponse massTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages) {
|
public SmsResponse massTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages) {
|
||||||
throw new SmsBlendException("布丁云V2暂不支持多条短信发送");
|
List<SmsResponse> list = new ArrayList<>();
|
||||||
|
for (String phone : phones) {
|
||||||
|
SmsResponse smsResponse = sendMessage(phone, templateId, messages);
|
||||||
|
list.add(smsResponse);
|
||||||
|
}
|
||||||
|
return SmsRespUtils.resp(list, true, getConfigId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> getHeaders() {
|
private Map<String, String> getHeaders() {
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public class ChuangLanSmsImpl extends AbstractSmsBlend<ChuangLanConfig> {
|
|||||||
}catch (SmsBlendException e) {
|
}catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,14 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static org.dromara.sms4j.huawei.utils.HuaweiBuilder.listToString;
|
import static org.dromara.sms4j.huawei.utils.HuaweiBuilder.listToString;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HuaweiSmsImpl extends AbstractSmsBlend<HuaweiConfig> {
|
public class HuaweiSmsImpl extends AbstractSmsBlend<HuaweiConfig> {
|
||||||
|
|
||||||
private int retry = 0;
|
private volatile int retry = 0;
|
||||||
|
|
||||||
public HuaweiSmsImpl(HuaweiConfig config, Executor pool, DelayedTime delayed) {
|
public HuaweiSmsImpl(HuaweiConfig config, Executor pool, DelayedTime delayed) {
|
||||||
super(config, pool, delayed);
|
super(config, pool, delayed);
|
||||||
@ -80,7 +81,7 @@ public class HuaweiSmsImpl extends AbstractSmsBlend<HuaweiConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class JdCloudSmsImpl extends AbstractSmsBlend<JdCloudConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,7 +119,7 @@ public class JgSmsImpl extends AbstractSmsBlend<JgConfig> {
|
|||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ public class MasSmsImpl extends AbstractSmsBlend<MasConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public class NeteaseSmsImpl extends AbstractSmsBlend<NeteaseConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public class QiNiuSmsImpl extends AbstractSmsBlend<QiNiuConfig> {
|
|||||||
}catch (SmsBlendException e){
|
}catch (SmsBlendException e){
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public class TencentSmsImpl extends AbstractSmsBlend<TencentConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ public class YunPianSmsImpl extends AbstractSmsBlend<YunpianConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class YunPianSmsImpl extends AbstractSmsBlend<YunpianConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,7 +155,7 @@ public class ZhutongSmsImpl extends AbstractSmsBlend<ZhutongConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ public class ZhutongSmsImpl extends AbstractSmsBlend<ZhutongConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ZhangJunSmsImpl extends AbstractSmsBlend<ZhangJunConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ZhangJunSmsImpl extends AbstractSmsBlend<ZhangJunConfig> {
|
|||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = errorResp(e.message);
|
smsResponse = errorResp(e.message);
|
||||||
}
|
}
|
||||||
if (smsResponse.isSuccess() || retry == getConfig().getMaxRetries()) {
|
if (smsResponse.isSuccess() || retry >= getConfig().getMaxRetries()) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
return smsResponse;
|
return smsResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user