Przeglądaj źródła

fix 兼容测试服端口

zwhui 3 lat temu
rodzic
commit
f7df619e25

+ 5 - 2
netflix-service/src/main/java/com/cyksj/common/EnvCommonService.java

@@ -24,6 +24,8 @@ public class EnvCommonService {
 
 	public static String DISTRIBUTE_DEFAULT_URL_PREFIX;
 
+	private static String port;
+
 	@Value(value = "${spring.profiles.active}")
 	private String env;
 
@@ -31,15 +33,16 @@ public class EnvCommonService {
 	private String domain;
 
 	public String getHost() {
+		port = EnvCommonService.active_prd.equals(getEnv()) ? "8081" : "8083";
 		return domain;
 	}
 
 	public String getDomain() {
-		return this.getHost().substring(0, this.getHost().indexOf("8081"));
+		return this.getHost().substring(0, this.getHost().indexOf(port));
 	}
 
 	public String getDomain2() {
-		return this.getHost().substring(0, this.getHost().indexOf("/8081"));
+		return this.getHost().substring(0, this.getHost().indexOf("/"+port));
 	}
 
 	public Boolean isPrdEnv() {