feat(device-liveness): 运营后台设备存活监控页(卡片/筛选/掉线置顶/刷新) (#20)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------

Co-authored-by: 陈世睿 <2839904623@qq.com>
Reviewed-on: #20
Co-authored-by: chenshirui <chenshirui@wonderable.ai>
Co-committed-by: chenshirui <chenshirui@wonderable.ai>
This commit was merged in pull request #20.
This commit is contained in:
chenshirui
2026-06-26 15:28:41 +08:00
committed by guke
parent 9b7a1aef8a
commit 5f2511e7cd
3 changed files with 288 additions and 0 deletions
+33
View File
@@ -44,6 +44,39 @@ export interface DeviceOnboardingItem {
last_completed_at: string;
}
// 设备存活监控:device_liveness 表一行 + 后端按心跳阈值派生的在线/掉线/掉线时长。
export interface DeviceLivenessItem {
id: number;
user_id: number;
phone: string | null;
nickname: string | null;
device_id: string;
device_model: string | null; // 由 device_id 解析的机型
platform: string;
app_version: string | null;
registration_id: string | null; // 非空 = 可极光推送
ever_protected: boolean;
first_protected_at: string | null; // 首次开无障碍时刻(老设备为 null)
last_heartbeat_at: string | null;
last_report_protection_on: boolean;
liveness_state: string; // unknown / alive / silent(当前未用) / notified
notified_at: string | null;
kill_alert_pending: boolean; // 掉线召回待客户端 ack
created_at: string;
updated_at: string;
// 后端派生
online: boolean;
display_state: string; // online 在线 / offline 已掉线 / never 未启用
offline_seconds: number | null; // 掉线时长(秒);仅 offline 有值
}
export interface DeviceLivenessStats {
total: number;
online: number;
offline: number;
never: number;
}
export interface UserOverview {
user: UserListItem;
coin_balance: number;