diff --git a/docs/src/.vuepress/.cache/deps_temp/_metadata.json b/docs/src/.vuepress/.cache/deps_temp/_metadata.json new file mode 100644 index 00000000..63ad0d2b --- /dev/null +++ b/docs/src/.vuepress/.cache/deps_temp/_metadata.json @@ -0,0 +1,38 @@ +{ + "hash": "2b79d460", + "browserHash": "bbb5b341", + "optimized": { + "@vueuse/core": { + "src": "../../../../node_modules/@vueuse/core/index.mjs", + "file": "@vueuse_core.js", + "fileHash": "49add9e9", + "needsInterop": false + }, + "@vuepress/shared": { + "src": "../../../../node_modules/@vuepress/shared/dist/index.js", + "file": "@vuepress_shared.js", + "fileHash": "30dbdfc5", + "needsInterop": false + }, + "vue": { + "src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", + "file": "vue.js", + "fileHash": "0859a21c", + "needsInterop": false + }, + "vue-router": { + "src": "../../../../node_modules/vue-router/dist/vue-router.esm-bundler.js", + "file": "vue-router.js", + "fileHash": "3d5d324e", + "needsInterop": false + } + }, + "chunks": { + "chunk-AWA6B2ZS": { + "file": "chunk-AWA6B2ZS.js" + }, + "chunk-JXWQMH7G": { + "file": "chunk-JXWQMH7G.js" + } + } +} \ No newline at end of file diff --git a/sms4j-core/src/main/java/org/dromara/sms4j/core/factory/SmsFactory.java b/sms4j-core/src/main/java/org/dromara/sms4j/core/factory/SmsFactory.java index ddfcf8dd..b0ba7690 100644 --- a/sms4j-core/src/main/java/org/dromara/sms4j/core/factory/SmsFactory.java +++ b/sms4j-core/src/main/java/org/dromara/sms4j/core/factory/SmsFactory.java @@ -14,8 +14,9 @@ import org.dromara.sms4j.unisms.config.UniSmsConfig; /** * SmsFactory - *

- * + *

构造工厂,用于获取一个厂商的短信实现对象 + * 在调用对应厂商的短信发送方法前,请先确保你的配置已经实现,否则无法发送该厂商对应的短信,一般情况下厂商会回执因缺少的配置所造成的的异常,但不会 + * 以java异常的形式抛出 * @author :Wind * 2023/4/8 15:55 **/ @@ -28,7 +29,6 @@ public class SmsFactory { /** * createSmsBlend *

获取各个厂商的实现类 - * * @param supplierType 厂商枚举 * @author :Wind */ @@ -51,4 +51,46 @@ public class SmsFactory { } throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid"); } + + /** + * refresh + *

刷新配置,用于切换配置后的刷新,防止因厂商sdk内部的保存导致配置更新不及时 + * 此方法会造成一定的性能损失,不建议经常性调用 + * @author :Wind + */ + public static void refresh(){ + AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig()); + HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig()); + UniSmsConfig.refresh(SupplierFactory.getUniConfig()); + TencentSmsConfig.refresh(SupplierFactory.getTencentConfig()); + JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig()); + CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig()); + EmaySmsConfig.refresh(SupplierFactory.getEmayConfig()); + } + + /** + * refresh + *

根据厂商类型枚举刷新对应厂商的配置,此方法不会刷新全部厂商的配置对象,只会重构所选厂商的对象,性能损失相对较小 + * @param supplierType 厂商类型枚举 + * @author :Wind + */ + public static void refresh(SupplierType supplierType){ + switch (supplierType) { + case ALIBABA: + AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig()); + case HUAWEI: + HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig()); + case UNI_SMS: + UniSmsConfig.refresh(SupplierFactory.getUniConfig()); + case TENCENT: + TencentSmsConfig.refresh(SupplierFactory.getTencentConfig()); + case JD_CLOUD: + JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig()); + case CLOOPEN: + CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig()); + case EMAY: + EmaySmsConfig.refresh(SupplierFactory.getEmayConfig()); + } + throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid"); + } }