Commit 166af8e9 authored by qinxunjia's avatar qinxunjia

https配置

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