修改短信验证码
This commit is contained in:
7
pom.xml
7
pom.xml
@@ -225,9 +225,9 @@
|
||||
<systemPath>${pom.basedir}/src/main/resources/lib/aspose-words-22.10-jdk16.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zmzm</groupId>
|
||||
<artifactId>sms-http</artifactId>
|
||||
<version>sms-http</version>
|
||||
<groupId>com.bcloud.msg.http</groupId>
|
||||
<artifactId>bcloud.msg.http</artifactId>
|
||||
<version>http</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/src/main/resources/lib/http.jar</systemPath>
|
||||
</dependency>
|
||||
@@ -448,6 +448,7 @@
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 跳过单元测试 -->
|
||||
|
||||
@@ -8,17 +8,21 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Configuration
|
||||
@Component
|
||||
public class SmsUtil {
|
||||
|
||||
@Value("${sms.domestic.url}")
|
||||
private String url;
|
||||
@Value("${sms.domestic.account}")
|
||||
private String account;
|
||||
@Value("${sms.domestic.pswd}")
|
||||
private String pswd;
|
||||
@Value("${sms.domestic.content}")
|
||||
private String content;
|
||||
@Value("${sms.abroad.url}")
|
||||
private String abroadUrl;
|
||||
@Value("${sms.abroad.account}")
|
||||
private String abroadAccount;
|
||||
@Value("${sms.abroad.pswd}")
|
||||
@@ -27,7 +31,6 @@ public class SmsUtil {
|
||||
private String abroadContent;
|
||||
|
||||
public R sendSmsCode(String phone, String code) {
|
||||
String uri = "http://116.62.212.142/msg/HttpBatchSendSM";//应用地址
|
||||
String mobiles = phone;//手机号码,多个号码使用","分割
|
||||
boolean needstatus = true;//是否需要状态报告,需要true,不需要false
|
||||
String product = "";//产品ID
|
||||
@@ -35,7 +38,7 @@ public class SmsUtil {
|
||||
String respType = "json";//返回json格式响应
|
||||
boolean encrypt = true;// 密码使用时间戳加密
|
||||
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":0,"msgid":"2150416115442493200","ts":"20250416115442"}
|
||||
JSONObject object = JSONObject.parseObject(returnString);
|
||||
@@ -57,7 +60,7 @@ public class SmsUtil {
|
||||
public R sendSmsAbroad(String phone, String code){
|
||||
try {
|
||||
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("" +
|
||||
"sp_id="+abroadAccount+
|
||||
"&password="+MD5Utils.getStrrMD5(abroadPswd)+
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.teautil.Common;
|
||||
import com.aliyun.teautil.models.RuntimeOptions;
|
||||
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.SmsUtil;
|
||||
import com.peanut.modules.app.config.SMSConfig;
|
||||
|
||||
@@ -73,10 +73,12 @@ aliyun:
|
||||
|
||||
sms:
|
||||
domestic:
|
||||
url: http://116.62.212.142/msg/HttpBatchSendSM
|
||||
account: MXT802795
|
||||
pswd: Zm802795
|
||||
content: 【天津众妙之门科技】,你的验证码为:XXXXXX,您正在进行身份验证,请勿泄露于他人!
|
||||
abroad:
|
||||
url: http://www.onesnok.net:9511/api/send-sms-single
|
||||
account: 921689
|
||||
pswd: 9de2a579
|
||||
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.
|
||||
|
||||
@@ -73,10 +73,12 @@ aliyun:
|
||||
|
||||
sms:
|
||||
domestic:
|
||||
url: http://116.62.212.142/msg/HttpBatchSendSM
|
||||
account: MXT802795
|
||||
pswd: Zm802795
|
||||
content: 【天津众妙之门科技】,你的验证码为:XXXXXX,您正在进行身份验证,请勿泄露于他人!
|
||||
abroad:
|
||||
url: http://www.onesnok.net:9511/api/send-sms-single
|
||||
account: 921689
|
||||
pswd: 9de2a579
|
||||
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.
|
||||
|
||||
@@ -72,10 +72,12 @@ aliyun:
|
||||
|
||||
sms:
|
||||
domestic:
|
||||
url: http://116.62.212.142/msg/HttpBatchSendSM
|
||||
account: MXT802795
|
||||
pswd: Zm802795
|
||||
content: 【天津众妙之门科技】,你的验证码为:XXXXXX,您正在进行身份验证,请勿泄露于他人!
|
||||
abroad:
|
||||
url: http://www.onesnok.net:9511/api/send-sms-single
|
||||
account: 921689
|
||||
pswd: 9de2a579
|
||||
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.
|
||||
|
||||
@@ -73,10 +73,12 @@ aliyun:
|
||||
|
||||
sms:
|
||||
domestic:
|
||||
url: http://116.62.212.142/msg/HttpBatchSendSM
|
||||
account: MXT802795
|
||||
pswd: Zm802795
|
||||
content: 【天津众妙之门科技】,你的验证码为:XXXXXX,您正在进行身份验证,请勿泄露于他人!
|
||||
abroad:
|
||||
url: http://www.onesnok.net:9511/api/send-sms-single
|
||||
account: 921689
|
||||
pswd: 9de2a579
|
||||
content: Tianjin Zhongmiao Gate Technology:Your verification code is:XXXXXX.
|
||||
|
||||
Reference in New Issue
Block a user