feat: 连接信息恢复的会话在 isLogin 时直接开放票据与风险功能
- 恢复时除了 GetUserDataApi 再拉一次 GetUserPreviewApi:服务器说 isLogin 为 true 就把这次会话当已登录,_gameLogin 落地,票据与风险页按「登录后 60 秒冷却」计时 (loginDateTime 取恢复当下),不必再发一次 UserLoginApi - GetUserPreviewApi 的响应里没有 loginId,而 UpsertUserAll 要拿它当 playlogId, 所以导出连接信息时把本机的 loginId 一起带过去,恢复端优先用这个值, 拉不到才退回 preview 里的字段(多半是 0) - 只有 Cookie、preview 拉不到、或服务器说没在登录中时仍按只读处理, 提示横幅与 SnackBar 文案区分「可写」和「只能读」两种恢复结果 - HomePage 的恢复入口收成 restored: SessionRestoreResult?,把 preview 与 userData 一起当种子,省掉两次重复请求
This commit is contained in:
1 parent
e74bb792bd
commit
44c4a1daae
7 files changed
+123
-37
No files matched your search
@@ -12,6 +12,7 @@ void main() {
|
||||
const share = SessionShare(
|
||||
userId: 1234567,
|
||||
token: 'SGWCMAIDABCDEF',
|
||||
loginId: 4242,
|
||||
cookie: 'JSESSIONID=abc123DEF',
|
||||
);
|
||||
|
||||
@@ -20,9 +21,18 @@ void main() {
|
||||
expect(decoded, isNotNull);
|
||||
expect(decoded!.userId, 1234567);
|
||||
expect(decoded.token, 'SGWCMAIDABCDEF');
|
||||
expect(decoded.loginId, 4242);
|
||||
expect(decoded.jsessionid, 'JSESSIONID=abc123DEF');
|
||||
});
|
||||
|
||||
test('旧串里没有 loginId 时按 0 处理', () {
|
||||
const share = SessionShare(userId: 9, token: 't', cookie: 'JSESSIONID=x');
|
||||
expect(share.loginId, 0);
|
||||
|
||||
final decoded = SessionShare.tryDecode(share.encode())!;
|
||||
expect(decoded.loginId, 0);
|
||||
});
|
||||
|
||||
test('只保留 JSESSIONID,忽略其它 Cookie', () {
|
||||
const share = SessionShare(
|
||||
userId: 1,
|
||||
|
||||
Reference in new issue
Block a user