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
@@ -1,4 +1,6 @@
|
||||
import '../config/title_server_config.dart';
|
||||
import '../core/date_time_format.dart';
|
||||
import '../core/json_value.dart';
|
||||
import '../models/user_character.dart';
|
||||
import 'title_api_service.dart';
|
||||
|
||||
@@ -43,28 +45,12 @@ class UserAllPayloadBuilder {
|
||||
|
||||
const UserAllPayloadBuilder(this.config);
|
||||
|
||||
static DateTime _shanghaiNow() =>
|
||||
DateTime.now().toUtc().add(const Duration(hours: 8));
|
||||
|
||||
static String _two(int v) => v.toString().padLeft(2, '0');
|
||||
|
||||
static String _formatPlayDate(DateTime dt) =>
|
||||
'${dt.year}-${_two(dt.month)}-${_two(dt.day)}';
|
||||
|
||||
static String _formatPlayDateTime(DateTime dt) =>
|
||||
'${dt.year}-${_two(dt.month)}-${_two(dt.day)} '
|
||||
'${_two(dt.hour)}:${_two(dt.minute)}:${_two(dt.second)}.0';
|
||||
|
||||
/// 客户端 `TimeManager.GetDateString` 的格式是
|
||||
/// `ToString("yyyy-MM-dd HH:mm:ss.f")`,也就是带一位小数的秒。
|
||||
/// 万花筒的 `clearDate` 之类字段要按这个形状给。
|
||||
static String nowTimestamp() => _formatPlayDateTime(_shanghaiNow());
|
||||
static String nowTimestamp() => formatPlayDateTime(shanghaiNow());
|
||||
|
||||
static int _toInt(dynamic v) {
|
||||
if (v is int) return v;
|
||||
if (v is num) return v.toInt();
|
||||
return 0;
|
||||
}
|
||||
static int _toInt(dynamic v) => jsonInt(v);
|
||||
|
||||
static int clampValue(int v) =>
|
||||
v < minValue ? minValue : (v > maxValue ? maxValue : v);
|
||||
@@ -122,11 +108,10 @@ class UserAllPayloadBuilder {
|
||||
(i) => i < charaSlot.length ? charaSlot[i] : 0,
|
||||
);
|
||||
|
||||
final now = _shanghaiNow();
|
||||
final playDate = _formatPlayDate(now);
|
||||
final playDateTime = _formatPlayDateTime(now);
|
||||
final loginDate =
|
||||
_formatPlayDateTime(DateTime.fromMillisecondsSinceEpoch(loginDateTime * 1000).toUtc().add(const Duration(hours: 8)));
|
||||
final now = shanghaiNow();
|
||||
final playDate = formatDate(now);
|
||||
final playDateTime = formatPlayDateTime(now);
|
||||
final loginDate = formatPlayDateTime(shanghaiFromUnixSeconds(loginDateTime));
|
||||
|
||||
// Lionheart: GetUserDataApi 返回的部分字段不能出现在 UpsertUserAll 的
|
||||
// userData 中,否则服务器会静默丢弃整包处理。
|
||||
|
||||
Reference in new issue
Block a user