mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-07 01:18:33 +08:00
更新了1.0.1版本号和部分文档
This commit is contained in:
parent
194229ac85
commit
d56587fc93
37
README.md
37
README.md
@ -8,6 +8,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 前言
|
## 前言
|
||||||
|
|
||||||
在日常的开发过程中,短信的发送经常使用(尤其是中小型的外包公司),毕竟不是每个公司都有阿里腾讯一样的实力,
|
在日常的开发过程中,短信的发送经常使用(尤其是中小型的外包公司),毕竟不是每个公司都有阿里腾讯一样的实力,
|
||||||
也不是每个都像银行联通等公司一样有内部的短信规程。第三方的短信往往是最常见的解决方案,但是市面上第三方短信服务商众多,
|
也不是每个都像银行联通等公司一样有内部的短信规程。第三方的短信往往是最常见的解决方案,但是市面上第三方短信服务商众多,
|
||||||
各家都有不同的方式和标准,每次需要使用时候,都需要花费时间去阅读文档和编写相应的工具,为一个短信浪费了太多的精力和时间。
|
各家都有不同的方式和标准,每次需要使用时候,都需要花费时间去阅读文档和编写相应的工具,为一个短信浪费了太多的精力和时间。
|
||||||
@ -19,14 +20,18 @@
|
|||||||
#### [在线文档](https://apidoc.gitee.com/the-wind-is-like-a-song/sms_aggregation)
|
#### [在线文档](https://apidoc.gitee.com/the-wind-is-like-a-song/sms_aggregation)
|
||||||
|
|
||||||
## 支持厂商一览
|
## 支持厂商一览
|
||||||
|
|
||||||
目前刚刚发布第一版本,支持尚少,后续会集成更多的厂商
|
目前刚刚发布第一版本,支持尚少,后续会集成更多的厂商
|
||||||
|
|
||||||
- **阿里云国内短信**
|
- **阿里云国内短信**
|
||||||
- **腾讯云国内短信**
|
- **腾讯云国内短信**
|
||||||
- **合一短信**
|
- **合一短信**
|
||||||
- **云片短信**
|
- **云片短信**
|
||||||
|
|
||||||
## 在SpringBoot环境集成
|
## 在SpringBoot环境集成
|
||||||
|
|
||||||
1. maven引入
|
1. maven引入
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
@ -35,6 +40,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
2. 设置配置文件
|
2. 设置配置文件
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
sms:
|
sms:
|
||||||
# 短信服务商
|
# 短信服务商
|
||||||
@ -48,6 +54,7 @@ sms:
|
|||||||
accountMax: 20
|
accountMax: 20
|
||||||
# 单账号每分钟最大发送
|
# 单账号每分钟最大发送
|
||||||
minuteMax: 2
|
minuteMax: 2
|
||||||
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
阿里云配置示意
|
阿里云配置示意
|
||||||
@ -69,7 +76,9 @@ sms:
|
|||||||
#请求地址 默认为dysmsapi.aliyuncs.com 如无特殊改变可以不用设置
|
#请求地址 默认为dysmsapi.aliyuncs.com 如无特殊改变可以不用设置
|
||||||
requestUrl: dysmsapi.aliyuncs.com
|
requestUrl: dysmsapi.aliyuncs.com
|
||||||
```
|
```
|
||||||
|
|
||||||
3. 方法使用
|
3. 方法使用
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class Demo{
|
public class Demo{
|
||||||
//此处作为演示使用,推荐使用构造注入或set注入
|
//此处作为演示使用,推荐使用构造注入或set注入
|
||||||
@ -81,13 +90,39 @@ public class Demo{
|
|||||||
SmsResponse smsResponse = sms.sendMessage("18888888888","测试固定模板短信");
|
SmsResponse smsResponse = sms.sendMessage("18888888888","测试固定模板短信");
|
||||||
System.out.println(smsResponse);
|
System.out.println(smsResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 配置详解
|
||||||
|
|
||||||
|
#### 线程池配置
|
||||||
|
|
||||||
|
每一家厂商都对于异步短信有不同的支持,有些甚至没有,为了统一存在一个异步短信,我们配置了一个线程池用于执行异步短信任务,线程池默认配置如下:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sms:
|
||||||
|
#核心线程池大小
|
||||||
|
corePoolSize: 10
|
||||||
|
#最大线程数
|
||||||
|
maxPoolSize: 30
|
||||||
|
#队列容量
|
||||||
|
queueCapacity: 50
|
||||||
|
#活跃时间
|
||||||
|
keepAliveSeconds: 60
|
||||||
|
# 线程名字前缀
|
||||||
|
threadNamePrefix: sms-executor-
|
||||||
|
#设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean
|
||||||
|
shutdownStrategy: true
|
||||||
|
```
|
||||||
|
|
||||||
|
以上线程池为默认的配置,如果有需要可以跟随自己的需求在yml文件进行配置
|
||||||
|
|
||||||
|
```
|
||||||
## 参与贡献
|
## 参与贡献
|
||||||
|
|
||||||
1. Fork 本仓库
|
1. Fork 本仓库
|
||||||
2. 新建 Feat_xxx 分支
|
2. 新建 Feat_xxx 分支
|
||||||
3. 提交代码
|
3. 提交代码
|
||||||
4. 新建 Pull Request
|
4. 新建 Pull Request
|
||||||
|
```
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<name>sms-aggregation</name>
|
<name>sms-aggregation</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<description>sms_aggregation</description>
|
<description>sms_aggregation</description>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<spring.boot.version>2.7.10</spring.boot.version>
|
<spring.boot.version>2.7.10</spring.boot.version>
|
||||||
<modules.version>1.0.0</modules.version>
|
<modules.version>1.0.1</modules.version>
|
||||||
<aliyun.version>2.0.23</aliyun.version>
|
<aliyun.version>2.0.23</aliyun.version>
|
||||||
<json.version>2.0.15</json.version>
|
<json.version>2.0.15</json.version>
|
||||||
<okhttp.version>3.14.9</okhttp.version>
|
<okhttp.version>3.14.9</okhttp.version>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-aliyun</artifactId>
|
<artifactId>sms-aggregation-aliyun</artifactId>
|
||||||
<name>sms-aggregation-aliyun</name>
|
<name>sms-aggregation-aliyun</name>
|
||||||
<description>sms-aggregation-aliyun</description>
|
<description>sms-aggregation-aliyun</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-api</artifactId>
|
<artifactId>sms-aggregation-api</artifactId>
|
||||||
<name>sms-aggregation-api</name>
|
<name>sms-aggregation-api</name>
|
||||||
<description>sms-aggregation-api</description>
|
<description>sms-aggregation-api</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-comm</artifactId>
|
<artifactId>sms-aggregation-comm</artifactId>
|
||||||
<name>sms-aggregation-comm</name>
|
<name>sms-aggregation-comm</name>
|
||||||
<description>sms-aggregation-comm</description>
|
<description>sms-aggregation-comm</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
||||||
<name>sms-aggregation-spring-boot-starter</name>
|
<name>sms-aggregation-spring-boot-starter</name>
|
||||||
<description>sms-aggregation-spring-boot-starter</description>
|
<description>sms-aggregation-spring-boot-starter</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-tencent</artifactId>
|
<artifactId>sms-aggregation-tencent</artifactId>
|
||||||
<name>sms-aggregation-tencent</name>
|
<name>sms-aggregation-tencent</name>
|
||||||
<description>sms-aggregation-tencent</description>
|
<description>sms-aggregation-tencent</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>sms-aggregation-unisms</artifactId>
|
<artifactId>sms-aggregation-unisms</artifactId>
|
||||||
<name>sms-aggregation-unisms</name>
|
<name>sms-aggregation-unisms</name>
|
||||||
<description>sms-aggregation-unisms</description>
|
<description>sms-aggregation-unisms</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms_aggregation</artifactId>
|
<artifactId>sms_aggregation</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>sms-aggregation-yunpian</artifactId>
|
<artifactId>sms-aggregation-yunpian</artifactId>
|
||||||
<name>sms-aggregation-yunpian</name>
|
<name>sms-aggregation-yunpian</name>
|
||||||
<description>sms-aggregation-yunpian</description>
|
<description>sms-aggregation-yunpian</description>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user