fix(app): 增加公网地址回退,远程/移动网络可连后端

This commit is contained in:
Zhou Weidong committed 2026-10-20 05:04:36 +08:00
1 parent 7ca7d20630
commit 19caaa0a22
1 file changed
+4 -1
+4 -1
View File
@@ -18,6 +18,9 @@ class AppConfig {
/// 办公室内网(Wi-Fi)直连地址,双网络自动切换时的首选。
static const String lanBaseUrl = 'http://192.168.31.250:8081';
/// 公网地址(远程/移动网络访问时使用)。
static const String publicBaseUrl = 'http://39.162.50.99:8081';
static const String _loopbackBaseUrl = 'http://127.0.0.1:8081';
static const String _overrideBaseUrl = String.fromEnvironment('API_BASE_URL');
@@ -83,7 +86,7 @@ class AppConfig {
// 内网不可达,回落到公网。
}
applyRuntimeBaseUrl(
compiledBaseUrl.isNotEmpty ? compiledBaseUrl : defaultBaseUrl,
compiledBaseUrl.isNotEmpty ? compiledBaseUrl : publicBaseUrl,
);
}