feat: 逻辑优化

This commit is contained in:
digua
2025-11-27 21:16:59 +08:00
parent e19a4474fe
commit 84bfab0b43
7 changed files with 20 additions and 374 deletions
+5
View File
@@ -178,6 +178,11 @@ export const qqJsonParser: ChatParser = {
// 转换时间戳(QQ 导出是毫秒,需要转为秒)
const timestamp = Math.floor(msg.timestamp / 1000)
// 过滤掉不合理的年份(2000年以前)
if (new Date(msg.timestamp).getFullYear() < 2000) {
continue
}
// 确定消息类型
const type = msg.system ? MessageType.SYSTEM : convertMessageType(msg.type, msg.content)
+11 -2
View File
@@ -184,8 +184,17 @@ export const qqTxtParser: ChatParser = {
name,
})
currentSender = { platformId: qqNumber, name }
currentTimestamp = parseDateTime(dateTimeStr)
const timestamp = parseDateTime(dateTimeStr)
// 过滤掉不合理的年份(2000年以前)
if (new Date(timestamp * 1000).getFullYear() < 2000) {
// 如果时间戳无效,标记为 null,后续不添加
currentSender = null
currentTimestamp = 0
} else {
currentSender = { platformId: qqNumber, name }
currentTimestamp = timestamp
}
} else {
// 这是消息内容行
currentContent.push(trimmedLine)