Commit 166af8e9 authored by qinxunjia's avatar qinxunjia

https配置

parent ec3564d0
......@@ -19,6 +19,7 @@ public class BgySMSConfig {
public static String api;
@Value("${system.config.bgy.appId}")
public void setAppId(String appId) {
BgySMSConfig.appId = appId;
......
......@@ -28,8 +28,8 @@ public class SendSmsUtil {
url = new URL(path);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("POST");// 提交模式
httpURLConnection.setConnectTimeout(10000);//连接超时 单位毫秒
httpURLConnection.setReadTimeout(10000);//读取超时 单位毫秒
httpURLConnection.setConnectTimeout(30000);//连接超时 单位毫秒
httpURLConnection.setReadTimeout(30000);//读取超时 单位毫秒
// 发送POST请求必须设置如下两行
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
......
package com.bgy.sms.channel.dmHub.config;
import com.bgy.sms.channel.bgy.config.BgySMSConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -18,6 +19,8 @@ public class DmHubConfig {
public static String shortUrl;
public static boolean surlConfig;
@Value("${system.config.dmHub.applicationId}")
public void setApplicationId(String applicationId) {
DmHubConfig.applicationId = applicationId;
......@@ -52,6 +55,10 @@ public class DmHubConfig {
public void setShortUrl(String shortUrl) {
DmHubConfig.shortUrl = shortUrl;
}
@Value("${system.config.dmHub.surlConfig}")
public void setSurlConfig(Boolean surlConfig) {
DmHubConfig.surlConfig = surlConfig;
}
}
......@@ -573,6 +573,12 @@ public class MessageServiceImpl implements MessageService {
System.out.println(substring);
keyBuffer = new StringBuffer(substring);
} else {
if ("surl".equals(key)) {
if (DmHubConfig.surlConfig) {
info = "https://" + info;
}
}
paramsMap.put(keyBuffer.toString(), String.valueOf(info));
keyList.add(keyBuffer.toString());
int key1 = keyBuffer.indexOf(key);
......
......@@ -52,6 +52,7 @@ system:
appId: 1smsdemo
appSecret: ac031765c3a8c9acc4747808e4fe5918
shortUrl: urlshort-xsma-sit.bgy.com.cn
surlConfig: false
logging:
level: debug
......
......@@ -49,6 +49,7 @@ system:
appId: ${smsAppId}
appSecret: ${smsSecret}
shortUrl: ${shortUrl}
surlConfig: ${surlConfig}
logging:
level: ${logLevel}
......
......@@ -48,6 +48,7 @@ system:
appId: 1smsdemo
appSecret: ac031765c3a8c9acc4747808e4fe5918
shortUrl: urlshort-xsma-sit.bgy.com.cn
surlConfig: true
logging:
level: debug
......
......@@ -8,7 +8,6 @@ info:
spring:
profiles:
# active: test
active: ${sms-active}
mybatis-plus:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment