From abb358100da6fb28d14c411439fc4a5b40ae0bc9 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 3 Mar 2026 23:17:12 -0800 Subject: [PATCH] =?UTF-8?q?fix(genex-mobile):=20=E8=BF=98=E5=8E=9F=20api.g?= =?UTF-8?q?ogenex.com=20+=20=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .cn 域名因未 ICP 备案被 ISP 拦截,继续使用 api.gogenex.com (HK IP)。 增加 [UpdateService] 和 [VersionChecker] 详细日志便于调试。 Co-Authored-By: Claude Sonnet 4.6 --- .../genex-mobile/lib/core/updater/update_service.dart | 2 ++ .../genex-mobile/lib/core/updater/version_checker.dart | 8 +++++++- frontend/genex-mobile/lib/main.dart | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/genex-mobile/lib/core/updater/update_service.dart b/frontend/genex-mobile/lib/core/updater/update_service.dart index 6439f73..878f55c 100644 --- a/frontend/genex-mobile/lib/core/updater/update_service.dart +++ b/frontend/genex-mobile/lib/core/updater/update_service.dart @@ -41,6 +41,7 @@ class UpdateService { Future checkForUpdate(BuildContext context) async { if (!_isInitialized || !_config.enabled) return; + debugPrint('[UpdateService] 开始检查更新 channel=${_config.channel} url=${_config.apiBaseUrl}'); _isShowingUpdateDialog = true; try { switch (_config.channel) { @@ -53,6 +54,7 @@ class UpdateService { } } finally { _isShowingUpdateDialog = false; + debugPrint('[UpdateService] 更新检查完成'); } } diff --git a/frontend/genex-mobile/lib/core/updater/version_checker.dart b/frontend/genex-mobile/lib/core/updater/version_checker.dart index d6998c0..c5d46a1 100644 --- a/frontend/genex-mobile/lib/core/updater/version_checker.dart +++ b/frontend/genex-mobile/lib/core/updater/version_checker.dart @@ -67,12 +67,18 @@ class VersionChecker { Future checkForUpdate() async { try { final currentInfo = await getCurrentVersion(); + debugPrint('[VersionChecker] 当前 buildNumber=${currentInfo.buildNumber} 开始检查...'); final latestInfo = await fetchLatestVersion(); - if (latestInfo == null) return null; + if (latestInfo == null) { + debugPrint('[VersionChecker] 服务端返回无需更新'); + return null; + } final currentCode = int.tryParse(currentInfo.buildNumber) ?? 0; + debugPrint('[VersionChecker] 服务端最新 versionCode=${latestInfo.versionCode} 本地=$currentCode'); if (latestInfo.versionCode > currentCode) { + debugPrint('[VersionChecker] 发现新版本 ${latestInfo.version},准备弹窗'); return latestInfo; } diff --git a/frontend/genex-mobile/lib/main.dart b/frontend/genex-mobile/lib/main.dart index 8df8dbd..5df7989 100644 --- a/frontend/genex-mobile/lib/main.dart +++ b/frontend/genex-mobile/lib/main.dart @@ -40,9 +40,9 @@ import 'features/coupons/presentation/pages/wallet_coupons_page.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - // 初始化升级服务(走 Nginx 反向代理 → Kong 网关,国内用 .cn 域名) + // 初始化升级服务(走 Nginx 反向代理 → Kong 网关) UpdateService().initialize(UpdateConfig.selfHosted( - apiBaseUrl: 'https://api.gogenex.cn', + apiBaseUrl: 'https://api.gogenex.com', enabled: true, ));