chore(config): 添加测试环境配置并支持可配置认证服务地址

This commit is contained in:
2026-10-30 16:51:47 +08:00
parent 3fef36a721
commit a4f49c7107
4 changed files with 59 additions and 3 deletions
@@ -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)//超时,毫秒
@@ -92,6 +92,11 @@ public class ConfigProperties {
*/
private String serverUrl;
/**
* 认证服务器地址(core 服务)
*/
private String authServerUrl = "https://gxtyzx-server.websoft.top/api";
/**
* 阿里云存储 OSS
* Endpoint
@@ -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))//表单内容