refactor: 拆分主页与公共组件,扫码登录改走 WinHTTP
- 抽出 lib/core 的日期/JSON 工具,收敛各页重复解析 - 主页与音乐风险页拆成组件,风险功能共用一套运行框架 - 修复设置页作为主页页签保存时弹掉根路由导致的黑屏 - 登录对齐 Astral aimedb 协议:84 位二维码校验、签名与请求头修正, 补 GlobalSign 中间证书;Windows 改用 WinHTTP 绕过服务端对 BoringSSL 的 TLS 指纹拦截(证书校验保持开启) - 补开发预览数据与测试
This commit is contained in:
1 parent
0cb5320290
commit
e9357f5969
55 files changed
+4387
-3392
No files matched your search
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../core/json_value.dart';
|
||||
import 'music_data_cache.dart';
|
||||
|
||||
class MusicInfo {
|
||||
@@ -62,32 +63,18 @@ class MusicDataService {
|
||||
if (decoded is! List) return;
|
||||
_byId.clear();
|
||||
for (final item in decoded.whereType<Map<String, dynamic>>()) {
|
||||
final id = _toInt(item['id']);
|
||||
final id = jsonInt(item['id']);
|
||||
if (id == 0) continue;
|
||||
final ds = item['ds'];
|
||||
_byId[id] = MusicInfo(
|
||||
title: item['title']?.toString() ?? 'Unknown',
|
||||
title: jsonString(item['title'], fallback: 'Unknown'),
|
||||
dsByLevel: ds is List
|
||||
? {
|
||||
for (var level = 0; level < ds.length; level++)
|
||||
level: _toDouble(ds[level]),
|
||||
level: jsonDouble(ds[level]),
|
||||
}
|
||||
: const {},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static int _toInt(dynamic v) {
|
||||
if (v is int) return v;
|
||||
if (v is num) return v.toInt();
|
||||
if (v is String) return int.tryParse(v) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static double _toDouble(dynamic v) {
|
||||
if (v is double) return v;
|
||||
if (v is int) return v.toDouble();
|
||||
if (v is String) return double.tryParse(v) ?? 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user