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, ));