From a4f49c71070264d2570774e840ddc275b47e966f Mon Sep 17 00:00:00 2001 From: weicw <594098497@qq.com> Date: Fri, 30 Oct 2026 16:51:47 +0800 Subject: [PATCH] =?UTF-8?q?chore(config):=20=E6=B7=BB=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=AF=E9=85=8D=E7=BD=AE=E8=AE=A4=E8=AF=81=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/controller/WebsiteController.java | 7 ++- .../common/core/config/ConfigProperties.java | 5 ++ .../security/JwtAuthenticationFilter.java | 2 +- .../resources/application-gxtyzx-test.yml | 48 +++++++++++++++++++ 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/application-gxtyzx-test.yml diff --git a/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java b/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java index 8320ec3..a6952ab 100644 --- a/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java +++ b/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java @@ -12,6 +12,7 @@ import com.gxwebsoft.cms.param.NavigationParam; import com.gxwebsoft.cms.param.WebsiteParam; import com.gxwebsoft.cms.service.*; import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.config.ConfigProperties; import com.gxwebsoft.common.core.security.JwtUtil; import com.gxwebsoft.common.core.utils.RedisUtil; import com.gxwebsoft.common.core.web.ApiResult; @@ -73,6 +74,8 @@ public class WebsiteController extends BaseController { private DictService dictService; @Resource private DictDataService dictDataService; + @Resource + private ConfigProperties configProperties; @ApiOperation("获取网站信息") @GetMapping("/getSiteInfo") @@ -132,7 +135,7 @@ public class WebsiteController extends BaseController { // 读取会员信息 if(access_token != null){ // 请求主服务器获取租户信息 - String result = HttpRequest.get("https://gxtyzx-server.websoft.top/api/auth/user") + String result = HttpRequest.get(configProperties.getAuthServerUrl() + "/auth/user") .header("Authorization", access_token) .header("Tenantid", tenantId.toString()) .timeout(20000)//超时,毫秒 @@ -179,7 +182,7 @@ public class WebsiteController extends BaseController { private void createWebsite(String access_token) { final Integer tenantId = getTenantId(); // 请求主服务器获取租户信息 - String result = HttpRequest.get("https://gxtyzx-server.websoft.top/api/auth/tenant") + String result = HttpRequest.get(configProperties.getAuthServerUrl() + "/auth/tenant") .header("Authorization", access_token) .header("Tenantid", tenantId.toString()) .timeout(20000)//超时,毫秒 diff --git a/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java b/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java index dfee5d3..1cccb6e 100644 --- a/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java +++ b/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java @@ -92,6 +92,11 @@ public class ConfigProperties { */ private String serverUrl; + /** + * 认证服务器地址(core 服务) + */ + private String authServerUrl = "https://gxtyzx-server.websoft.top/api"; + /** * 阿里云存储 OSS * Endpoint diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java index 2d31f2a..8267536 100644 --- a/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java @@ -63,7 +63,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { map.put("username", jwtSubject.getUsername()); map.put("tenantId", jwtSubject.getTenantId()); // 链式构建请求 - String result = HttpRequest.post("https://gxtyzx-server.websoft.top/api/auth/user") + String result = HttpRequest.post(configProperties.getAuthServerUrl() + "/auth/user") .header("Authorization", access_token) .header("Tenantid", jwtSubject.getTenantId().toString()) .body(JSONUtil.toJSONString(map))//表单内容 diff --git a/src/main/resources/application-gxtyzx-test.yml b/src/main/resources/application-gxtyzx-test.yml new file mode 100644 index 0000000..e1ce706 --- /dev/null +++ b/src/main/resources/application-gxtyzx-test.yml @@ -0,0 +1,48 @@ +# 测试环境配置(8.134.55.105:13306 / 本地 Redis database 5) +# +# 启动方式: +# ./mvnw spring-boot:run -Dspring-boot.run.profiles=gxtyzx-test +# 或: +# java -jar target/com-gxwebsoft-server-1.5.2.jar --spring.profiles.active=gxtyzx-test + +spring: + datasource: + dynamic: + primary: master + strict: false + datasource: + master: + url: jdbc:mysql://8.134.55.105:13306/db_gxtyzx?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 + username: db_gxtyzx + password: ekXdi5iJMjHKaw3K + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + server: + url: jdbc:mysql://8.134.55.105:13306/gxtyzx_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + username: db_gxtyzx + password: ekXdi5iJMjHKaw3K + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + redis: + database: 5 + host: 127.0.0.1 + port: 6379 + password: + +# 日志配置 +logging: + level: + com.gxwebsoft: INFO + com.baomidou.mybatisplus: INFO + +socketio: + host: localhost #IP地址 + +# 框架配置 +config: + server-url: http://127.0.0.1:9099/api + # core 认证服务地址(登录/用户/租户校验) + auth-server-url: http://127.0.0.1:8001/api + upload-path: /tmp/gxtyzx-uploads/ + local-upload-path: /tmp/gxtyzx-uploads/ + open-office-home: /usr/lib/libreoffice