fix(client): 设备列表离线时间改用 last_seen「最后在线」(原 last_login 不准)

设备列表对离线设备显示「最后登录 X 前」,取的是 last_login(会话创建那一刻)。一直在线
的设备断开后会错显成登录时间(如 13 小时前),与实际「最后活跃」不符。改用 last_seen
(连接/用量上报/~15s 会话轮询都会刷新),标签相应改为「最后在线」/「Last online」。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-30 22:30:43 +08:00
parent 1666b1d462
commit d0d39c93f6
4 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -185,7 +185,9 @@ class DevicesScreen extends ConsumerWidget {
final name = d.name.isNotEmpty ? d.name : d.platformKind.label;
final subParts = <String>[d.platformKind.label];
if (d.clientVersion.isNotEmpty) subParts.add(d.clientVersion);
if (!d.online) subParts.add('${t.devLastLogin} ${_rel(d.lastLogin)}');
// 离线设备显示「最后在线」——用 last_seen(连接/用量/~15s 会话轮询都会刷新),
// 而非 last_login(仅登录那一刻);否则一直在线的设备会错显成登录时间(如 13 小时前)。
if (!d.online) subParts.add('${t.devLastOnline} ${_rel(d.lastSeen)}');
return Container(
decoration: BoxDecoration(border: divider ? Border(bottom: BorderSide(color: c.border)) : null),