From d60f1d3c5d9b962ab1316eafc132c0c0a371ba2c Mon Sep 17 00:00:00 2001 From: speakeloudest Date: Mon, 19 Jan 2026 08:22:51 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E5=A4=87=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=8E=9F=E5=9B=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/app/common/app_run_data.dart | 11 ++++++++--- .../kr_splash/controllers/kr_splash_controller.dart | 2 +- 邀请文档.md | 8 +++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/app/common/app_run_data.dart b/lib/app/common/app_run_data.dart index 2c096e9..0657192 100755 --- a/lib/app/common/app_run_data.dart +++ b/lib/app/common/app_run_data.dart @@ -59,6 +59,9 @@ class KRAppRunData { /// 设备ID String? deviceId; + /// 最后一次设备登录错误信息 + String? kr_lastDeviceLoginError; + /// 区号 String? kr_areaCode; @@ -310,7 +313,7 @@ class KRAppRunData { if (!success) { // 设备登录失败 → 提示用户重试 HIDialog.show( - message: '设备登录失败,请检查网络或重试', + message: '设备登录失败\n\n原因:${kr_lastDeviceLoginError ?? "未知错误"}\n\n请检查网络或重试', confirmText: '重试', preventBackDismiss: true, onConfirm: () async { @@ -388,7 +391,7 @@ class KRAppRunData { KRCommonUtil.kr_hideLoading(); // 设备登录失败 → 提示用户重试 HIDialog.show( - message: '设备登录失败,请检查网络或重试', + message: '设备登录失败\n\n原因:${kr_lastDeviceLoginError ?? "未知错误"}\n\n请检查网络或重试', confirmText: '重试', preventBackDismiss: true, onConfirm: () async { @@ -435,6 +438,7 @@ class KRAppRunData { return await result.fold( (error) { + kr_lastDeviceLoginError = error.msg; print('❌ 设备登录失败: ${error.msg}'); KRLogUtil.kr_e('❌ 设备登录失败: ${error.msg}', tag: 'SplashController'); _logStepTiming('设备登录完成'); @@ -470,7 +474,8 @@ class KRAppRunData { ); } catch (e, stackTrace) { print('❌ 设备登录检查异常: $e'); - print('📚 堆栈跟踪: $stackTrace'); + print('📚 堆栈跟踪: $stackTrace'); + kr_lastDeviceLoginError = e.toString(); KRLogUtil.kr_e('❌ 设备登录检查异常: $e', tag: 'SplashController'); return false; } diff --git a/lib/app/modules/kr_splash/controllers/kr_splash_controller.dart b/lib/app/modules/kr_splash/controllers/kr_splash_controller.dart index 8bbd460..609019c 100755 --- a/lib/app/modules/kr_splash/controllers/kr_splash_controller.dart +++ b/lib/app/modules/kr_splash/controllers/kr_splash_controller.dart @@ -450,7 +450,7 @@ class KRSplashController extends GetxController { if (!success) { // 设备登录失败 → 提示用户重试 HIDialog.show( - message: '设备登录失败,请检查网络或重试', + message: '设备登录失败\n\n原因:${KRAppRunData.getInstance().kr_lastDeviceLoginError ?? "未知错误"}\n\n请检查网络或重试', confirmText: '重试', preventBackDismiss: true, onConfirm: () async { diff --git a/邀请文档.md b/邀请文档.md index 1fd9a60..4a1ed92 100644 --- a/邀请文档.md +++ b/邀请文档.md @@ -20,7 +20,13 @@ - 静默:仅打印控制台日志,不走响应弹窗,不清理本地状态,不重试 ### 桌面平台(Windows/macOS) -- 从可执行/包名解析邀请码:命名规范 ic-,正则 /ic-([A-Za-z0-9-_]+)/ +- **识别规范**:文件名或路径中包含 `ic-`,例如 `HiFastVPN-ic-888.dmg`。 +- **解析逻辑(分层检测策略)**: + 1. **直接路径匹配 (Win/Mac 通用)**:从当前运行的 `.exe` 或 `.app` 全路径中正则提取。这是最直接、最高效的手段。 + 2. **挂载源追溯 (macOS 独有)**:通过 `hdiutil info` 关联运行中的 App 及其原始 `.dmg` 文件名。专门解决“程序未改名但在已命名的镜像中运行”的场景。 + 3. **下载元数据提取 (macOS 独有)**:通过 `mdls` 读取文件扩展属性。即便安装包已清理,只要系统保留了下载来源记录,仍可识别。 + 4. **下载目录智能扫描 (Win/Mac 通用)**:作为最后兜底,扫描用户下载目录(Downloads)下最近修改的、符合命名规范的镜像或安装包(`.dmg`/`.exe`)。 +- **调试支持**:当 `inviteDebugMode` 开启且识别到邀请码时,桌面端会弹出确认对话框。 ### 网络层标识(silentInvite) - 载体:Dio RequestOptions.extra(可选 Header: X-Client-Mode: invite_silent)