mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-06 17:08:40 +08:00
获取实例的常用方法(getByLoad和getByConfigId)更名为 getSmsBlend 方便使用
This commit is contained in:
parent
d383ec6645
commit
9b03996af6
@ -86,16 +86,6 @@ public abstract class SmsFactory {
|
|||||||
return (SmsBlend) Proxy.newProxyInstance(sms.getClass().getClassLoader(), new Class[]{SmsBlend.class}, smsInvocationHandler);
|
return (SmsBlend) Proxy.newProxyInstance(sms.getClass().getClassLoader(), new Class[]{SmsBlend.class}, smsInvocationHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过configId获取短信服务对象
|
|
||||||
*
|
|
||||||
* @param configId 唯一标识
|
|
||||||
* @return 返回短信服务对象。如果未找到则返回null
|
|
||||||
*/
|
|
||||||
public static SmsBlend getByConfigId(String configId) {
|
|
||||||
return blends.get(configId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过供应商标识获取首个短信服务对象
|
* 通过供应商标识获取首个短信服务对象
|
||||||
*
|
*
|
||||||
@ -129,10 +119,20 @@ public abstract class SmsFactory {
|
|||||||
*
|
*
|
||||||
* @return 返回短信服务列表
|
* @return 返回短信服务列表
|
||||||
*/
|
*/
|
||||||
public static SmsBlend getByLoad() {
|
public static SmsBlend getSmsBlend() {
|
||||||
return SmsLoad.getBeanLoad().getLoadServer();
|
return SmsLoad.getBeanLoad().getLoadServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过configId获取短信服务对象
|
||||||
|
*
|
||||||
|
* @param configId 唯一标识
|
||||||
|
* @return 返回短信服务对象。如果未找到则返回null
|
||||||
|
*/
|
||||||
|
public static SmsBlend getSmsBlend(String configId) {
|
||||||
|
return blends.get(configId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部短信服务对象
|
* 获取全部短信服务对象
|
||||||
*
|
*
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class Sms4jTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 通过负载均衡服务获取短信服务对象
|
// 通过负载均衡服务获取短信服务对象
|
||||||
SmsResponse smsResponse = SmsFactory.getByLoad().sendMessage(PHONE, SmsUtil.getRandomInt(6));
|
SmsResponse smsResponse = SmsFactory.getSmsBlend().sendMessage(PHONE, SmsUtil.getRandomInt(6));
|
||||||
Assert.isTrue(smsResponse.isSuccess());
|
Assert.isTrue(smsResponse.isSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user