refactor: 重构一下档案搜索功能 支持拼音微信号等

This commit is contained in:
电摇小子 committed 2026-09-03 23:38:12 +08:00
1 parent bde3bc537f
commit 21e299942b
17 files changed
+365 -44

No files matched your search

+19 -1
View File
@@ -9,6 +9,8 @@ export interface UserContact {
remark?: string
alias?: string
wechatId?: string
wxid?: string
legacyIdentifier?: string
isFolded?: boolean
isMuted?: boolean
}
@@ -105,7 +107,15 @@ export class WechatDb {
wechatNickname: session.wechatNickname,
remark: session.remark,
alias: session.alias,
wechatId: session.wechatId,
wechatId:
session.wechatId || this.wcdb4Client.getContactIdentity(session.username)?.wechatId,
wxid:
session.wxid ||
this.wcdb4Client.getContactIdentity(session.username)?.wxid ||
session.username,
legacyIdentifier:
session.legacyIdentifier ||
this.wcdb4Client.getContactIdentity(session.username)?.legacyIdentifier,
isFolded: session.isFolded,
isMuted: session.isMuted
}))
@@ -117,11 +127,19 @@ export class WechatDb {
contact.nickname,
contact.alias,
contact.wechatId,
contact.wxid,
contact.m_nsUsrName
].some((value) => value?.toLocaleLowerCase().includes(keyword))
})
}
public async hydrateContactIdentitiesAsync(): Promise<void> {
const sessions = this.wcdb4Client.getSessions()
await this.wcdb4Client.hydrateContactIdentitiesAsync(
sessions.map((session) => session.username)
)
}
public getAllGroupContacts(): Record<string, string> {
const groupContacts: Record<string, string> = {}
for (const session of this.wcdb4Client.getSessions()) {