修改短信验证码

This commit is contained in:
wuchunlei
2025-04-16 17:39:34 +08:00
parent d1746c678f
commit 4f6517caa9
7 changed files with 20 additions and 9 deletions

View File

@@ -225,9 +225,9 @@
<systemPath>${pom.basedir}/src/main/resources/lib/aspose-words-22.10-jdk16.jar</systemPath> <systemPath>${pom.basedir}/src/main/resources/lib/aspose-words-22.10-jdk16.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zmzm</groupId> <groupId>com.bcloud.msg.http</groupId>
<artifactId>sms-http</artifactId> <artifactId>bcloud.msg.http</artifactId>
<version>sms-http</version> <version>http</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${pom.basedir}/src/main/resources/lib/http.jar</systemPath> <systemPath>${pom.basedir}/src/main/resources/lib/http.jar</systemPath>
</dependency> </dependency>
@@ -448,6 +448,7 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<fork>true</fork> <fork>true</fork>
<includeSystemScope>true</includeSystemScope>
</configuration> </configuration>
</plugin> </plugin>
<!-- 跳过单元测试 --> <!-- 跳过单元测试 -->

View File

@@ -8,17 +8,21 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component;
@Configuration @Component
public class SmsUtil { public class SmsUtil {
@Value("${sms.domestic.url}")
private String url;
@Value("${sms.domestic.account}") @Value("${sms.domestic.account}")
private String account; private String account;
@Value("${sms.domestic.pswd}") @Value("${sms.domestic.pswd}")
private String pswd; private String pswd;
@Value("${sms.domestic.content}") @Value("${sms.domestic.content}")
private String content; private String content;
@Value("${sms.abroad.url}")
private String abroadUrl;
@Value("${sms.abroad.account}") @Value("${sms.abroad.account}")
private String abroadAccount; private String abroadAccount;
@Value("${sms.abroad.pswd}") @Value("${sms.abroad.pswd}")
@@ -27,7 +31,6 @@ public class SmsUtil {
private String abroadContent; private String abroadContent;
public R sendSmsCode(String phone, String code) { public R sendSmsCode(String phone, String code) {
String uri = "http://116.62.212.142/msg/HttpBatchSendSM";//应用地址
String mobiles = phone;//手机号码,多个号码使用","分割 String mobiles = phone;//手机号码,多个号码使用","分割
boolean needstatus = true;//是否需要状态报告需要true不需要false boolean needstatus = true;//是否需要状态报告需要true不需要false
String product = "";//产品ID String product = "";//产品ID
@@ -35,7 +38,7 @@ public class SmsUtil {
String respType = "json";//返回json格式响应 String respType = "json";//返回json格式响应
boolean encrypt = true;// 密码使用时间戳加密 boolean encrypt = true;// 密码使用时间戳加密
try { try {
String returnString = HttpSender.send(uri, account, pswd, mobiles, content.replace("XXXXXX",code), needstatus, product, extno, respType, encrypt); String returnString = HttpSender.send(url, account, pswd, mobiles, content.replace("XXXXXX",code), needstatus, product, extno, respType, encrypt);
//{"result":108,"ts":"20250416115415"} //{"result":108,"ts":"20250416115415"}
//{"result":0,"msgid":"2150416115442493200","ts":"20250416115442"} //{"result":0,"msgid":"2150416115442493200","ts":"20250416115442"}
JSONObject object = JSONObject.parseObject(returnString); JSONObject object = JSONObject.parseObject(returnString);
@@ -57,7 +60,7 @@ public class SmsUtil {
public R sendSmsAbroad(String phone, String code){ public R sendSmsAbroad(String phone, String code){
try { try {
CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("http://www.onesnok.net:9511/api/send-sms-single"); HttpPost httpPost = new HttpPost(abroadUrl);
StringEntity entity = new StringEntity("" + StringEntity entity = new StringEntity("" +
"sp_id="+abroadAccount+ "sp_id="+abroadAccount+
"&password="+MD5Utils.getStrrMD5(abroadPswd)+ "&password="+MD5Utils.getStrrMD5(abroadPswd)+

View File

@@ -7,7 +7,6 @@ import com.aliyun.tea.TeaException;
import com.aliyun.teautil.Common; import com.aliyun.teautil.Common;
import com.aliyun.teautil.models.RuntimeOptions; import com.aliyun.teautil.models.RuntimeOptions;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bcloud.msg.http.HttpSender;
import com.peanut.common.utils.R; import com.peanut.common.utils.R;
import com.peanut.common.utils.SmsUtil; import com.peanut.common.utils.SmsUtil;
import com.peanut.modules.app.config.SMSConfig; import com.peanut.modules.app.config.SMSConfig;

View File

@@ -73,10 +73,12 @@ aliyun:
sms: sms:
domestic: domestic:
url: http://116.62.212.142/msg/HttpBatchSendSM
account: MXT802795 account: MXT802795
pswd: Zm802795 pswd: Zm802795
content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人 content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人
abroad: abroad:
url: http://www.onesnok.net:9511/api/send-sms-single
account: 921689 account: 921689
pswd: 9de2a579 pswd: 9de2a579
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX. content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.

View File

@@ -73,10 +73,12 @@ aliyun:
sms: sms:
domestic: domestic:
url: http://116.62.212.142/msg/HttpBatchSendSM
account: MXT802795 account: MXT802795
pswd: Zm802795 pswd: Zm802795
content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人 content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人
abroad: abroad:
url: http://www.onesnok.net:9511/api/send-sms-single
account: 921689 account: 921689
pswd: 9de2a579 pswd: 9de2a579
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX. content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.

View File

@@ -72,10 +72,12 @@ aliyun:
sms: sms:
domestic: domestic:
url: http://116.62.212.142/msg/HttpBatchSendSM
account: MXT802795 account: MXT802795
pswd: Zm802795 pswd: Zm802795
content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人 content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人
abroad: abroad:
url: http://www.onesnok.net:9511/api/send-sms-single
account: 921689 account: 921689
pswd: 9de2a579 pswd: 9de2a579
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX. content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.

View File

@@ -73,10 +73,12 @@ aliyun:
sms: sms:
domestic: domestic:
url: http://116.62.212.142/msg/HttpBatchSendSM
account: MXT802795 account: MXT802795
pswd: Zm802795 pswd: Zm802795
content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人 content: 【天津众妙之门科技】你的验证码为XXXXXX您正在进行身份验证请勿泄露于他人
abroad: abroad:
url: http://www.onesnok.net:9511/api/send-sms-single
account: 921689 account: 921689
pswd: 9de2a579 pswd: 9de2a579
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX. content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.