mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-12-01 09:15:41 +08:00
feat: 支持导出自定义目录并优化聊天记录读取
接入导出保存目录选择功能 修复导出路径摘要未同步更新 按时间范围查询聊天记录,避免全量扫描历史消息 增加跨分片消息查询支持验证
This commit is contained in:
1 parent
412a509b2b
commit
55f91370be
9 files changed
+29
-16
No files matched your search
+5
-11
@@ -216,17 +216,11 @@ export class WechatDb {
|
||||
if (!username) return []
|
||||
if (startTime && endTime && startTime > endTime) return []
|
||||
|
||||
// A bounded native cursor can omit rows stored across a message shard boundary.
|
||||
// Scan without bounds first, then apply the requested range in application code.
|
||||
const rows = await this.wcdb4Client.getMessagesAsync(username)
|
||||
const messages = rows
|
||||
.map((message) => ({ ...message.raw, ...message }))
|
||||
.filter((message) => {
|
||||
const createTime = Number(message.msgCreateTime || 0)
|
||||
if (startTime && createTime < startTime) return false
|
||||
if (endTime && createTime > endTime) return false
|
||||
return true
|
||||
})
|
||||
// The async client merges cursor and shard-table results while applying the
|
||||
// time range in SQLite. Avoid loading the entire conversation when exporting
|
||||
// a narrow range; this is especially important for chats with long history.
|
||||
const rows = await this.wcdb4Client.getMessagesAsync(username, startTime, endTime)
|
||||
const messages = rows.map((message) => ({ ...message.raw, ...message }))
|
||||
console.log(
|
||||
`[WechatDb] export scan username=${username} raw=${rows.length} filtered=${messages.length} start=${startTime || 0} end=${endTime || 0}`
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user