refactor: 拆分主页与公共组件,扫码登录改走 WinHTTP

- 抽出 lib/core 的日期/JSON 工具,收敛各页重复解析
- 主页与音乐风险页拆成组件,风险功能共用一套运行框架
- 修复设置页作为主页页签保存时弹掉根路由导致的黑屏
- 登录对齐 Astral aimedb 协议:84 位二维码校验、签名与请求头修正,
  补 GlobalSign 中间证书;Windows 改用 WinHTTP 绕过服务端对
  BoringSSL 的 TLS 指纹拦截(证书校验保持开启)
- 补开发预览数据与测试
This commit is contained in:
Bad0RANG3 committed 2026-10-25 15:51:10 +08:00
1 parent 0cb5320290
commit e9357f5969
55 files changed
+4387 -3392

No files matched your search

+23 -41
View File
@@ -1,3 +1,5 @@
import '../core/json_value.dart';
class UserPreviewDataBean {
final int userId;
final String userName;
@@ -49,48 +51,28 @@ class UserPreviewDataBean {
});
factory UserPreviewDataBean.fromJson(Map<String, dynamic> json) {
int toInt(dynamic v) {
if (v == null) return 0;
if (v is int) return v;
if (v is String) return int.tryParse(v) ?? 0;
if (v is double) return v.toInt();
return 0;
}
bool toBool(dynamic v) {
if (v == null) return false;
if (v is bool) return v;
if (v is int) return v != 0;
if (v is String) return v == '1' || v.toLowerCase() == 'true';
return false;
}
String toStr(dynamic v) => v?.toString() ?? '';
return UserPreviewDataBean(
userId: toInt(json['userId']),
userName: toStr(json['userName']),
isLogin: toBool(json['isLogin']),
loginId: toInt(json['loginId']),
lastGameId: toStr(json['lastGameId']),
lastRomVersion: toStr(json['lastRomVersion']),
lastDataVersion: toStr(json['lastDataVersion']),
lastLoginDate: toStr(json['lastLoginDate']),
lastPlayDate: toStr(json['lastPlayDate']),
playerRating: toInt(json['playerRating']),
nameplateId: toInt(json['nameplateId']),
iconId: toInt(json['iconId']),
trophyId: toInt(json['trophyId']),
isNetMember: toBool(json['isNetMember']),
isInherit: toBool(json['isInherit']),
totalAwake: toInt(json['totalAwake']),
dispRate: toInt(json['dispRate']),
dailyBonusDate: toStr(json['dailyBonusDate']),
headPhoneVolume: (json['headPhoneVolume'] is String)
? (int.tryParse(json['headPhoneVolume']) ?? 0)
: toInt(json['headPhoneVolume']),
banState: toInt(json['banState']),
errorId: toInt(json['errorId']),
userId: jsonInt(json['userId']),
userName: jsonString(json['userName']),
isLogin: jsonBool(json['isLogin']),
loginId: jsonInt(json['loginId']),
lastGameId: jsonString(json['lastGameId']),
lastRomVersion: jsonString(json['lastRomVersion']),
lastDataVersion: jsonString(json['lastDataVersion']),
lastLoginDate: jsonString(json['lastLoginDate']),
lastPlayDate: jsonString(json['lastPlayDate']),
playerRating: jsonInt(json['playerRating']),
nameplateId: jsonInt(json['nameplateId']),
iconId: jsonInt(json['iconId']),
trophyId: jsonInt(json['trophyId']),
isNetMember: jsonBool(json['isNetMember']),
isInherit: jsonBool(json['isInherit']),
totalAwake: jsonInt(json['totalAwake']),
dispRate: jsonInt(json['dispRate']),
dailyBonusDate: jsonString(json['dailyBonusDate']),
headPhoneVolume: jsonInt(json['headPhoneVolume']),
banState: jsonInt(json['banState']),
errorId: jsonInt(json['errorId']),
);
}
}