fix: 设备登录失败原因打印

This commit is contained in:
speakeloudest 2026-01-19 08:22:51 -08:00
parent d89e8782e6
commit d60f1d3c5d
3 changed files with 16 additions and 5 deletions

View File

@ -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;
}

View File

@ -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 {

View File

@ -20,7 +20,13 @@
- 静默:仅打印控制台日志,不走响应弹窗,不清理本地状态,不重试
### 桌面平台Windows/macOS
- 从可执行/包名解析邀请码:命名规范 ic-<code>,正则 /ic-([A-Za-z0-9-_]+)/
- **识别规范**:文件名或路径中包含 `ic-<code>`,例如 `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