feat(userManagement): 同步前读设备主用户并支持长按清空重新下发

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-25 16:11:55 +08:00
co-authored by Claude Opus 4.7
parent f6d6591c69
commit 2595080d9a
3 changed files with 134 additions and 45 deletions
+14
View File
@@ -443,6 +443,20 @@ class LeFuService {
})
}
/**
* 获取设备端主用户的 userId 列表
* 未连接 reject;成功返回主用户 userId 数组,无主用户返回 null
*/
fetchDeviceUserIds(): Promise<string[] | null> {
return new Promise((resolve, reject) => {
if (!this._activeProtocol) { reject(new Error('设备未连接')); return }
this._activeProtocol.dataFetchUserID((res: any) => {
console.log(TAG, 'dataFetchUserID:', res)
resolve(res ?? null)
})
})
}
// ─── 私有:保活与重连 ───────────────────────
/** 启动保活心跳:文档建议每 10s 发送一次 keepAlive,防止设备主动断开 */
private _startKeepAlive(): void {