mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-06-14 19:57:04 +08:00
feat: 逻辑优化
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user