From 4b17d203256855dcad605b6ed34260af43c6d35b Mon Sep 17 00:00:00 2001 From: xuncha <1658671838@qq.com> Date: Fri, 20 Mar 2026 17:11:28 +0800 Subject: [PATCH] =?UTF-8?q?weclone=E5=AF=BC=E5=87=BA=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=9C=89=E5=BC=95=E7=94=A8=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/exportService.ts | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/electron/services/exportService.ts b/electron/services/exportService.ts index 89e77ca..8aa5d9d 100644 --- a/electron/services/exportService.ts +++ b/electron/services/exportService.ts @@ -1923,6 +1923,16 @@ class ExportService { } } + private isQuotedReplyMessage(localType: number, content: string): boolean { + if (localType === 244813135921) return true + const normalized = this.normalizeAppMessageContent(content || '') + if (!(localType === 49 || normalized.includes(''))) { + return false + } + const subType = this.extractAppMessageType(normalized) + return subType === '57' || normalized.includes('') + } + private async resolveQuotedReplyDisplayWithNames(args: { content: string isGroup: boolean @@ -6813,7 +6823,7 @@ class ExportService { control, collectProgressReporter ) - const totalMessages = collected.rows.length + let totalMessages = collected.rows.length if (totalMessages === 0) { return { success: false, error: '该会话在指定时间范围内没有消息' } } @@ -6841,7 +6851,13 @@ class ExportService { ? await this.getGroupNicknamesForRoom(sessionId, groupNicknameCandidates) : new Map() - const sortedMessages = collected.rows.sort((a, b) => a.createTime - b.createTime) + const sortedMessages = collected.rows + .sort((a, b) => a.createTime - b.createTime) + .filter((msg) => !this.isQuotedReplyMessage(msg.localType, msg.content || '')) + totalMessages = sortedMessages.length + if (totalMessages === 0) { + return { success: false, error: '该会话在指定时间范围内没有可导出的消息' } + } const voiceMessages = options.exportVoiceAsText ? sortedMessages.filter(msg => msg.localType === 34) @@ -6966,7 +6982,7 @@ class ExportService { }) const lines: string[] = [] - lines.push('id,MsgSvrID,ReplyToMsgSvrID,type_name,is_sender,talker,msg,src,CreateTime') + lines.push('id,MsgSvrID,type_name,is_sender,talker,msg,src,CreateTime') const senderProfileCache = new Map() for (let i = 0; i < totalMessages; i++) { @@ -7032,31 +7048,16 @@ class ExportService { msg.senderUsername, msg.isSend ) || '') - const quotedReplyDisplay = await this.resolveQuotedReplyDisplayWithNames({ - content: msg.content, - isGroup, - displayNamePreference: options.displayNamePreference, - getContact: getContactCached, - groupNicknamesMap, - cleanedMyWxid, - rawMyWxid, - myDisplayName: myInfo.displayName || cleanedMyWxid - }) - const finalMsgText = quotedReplyDisplay - ? this.buildQuotedReplyText(quotedReplyDisplay) - : msgText const src = this.getWeCloneSource(msg, typeName, mediaItem) const platformMessageId = this.getExportPlatformMessageId(msg) || '' - const replyToMessageId = this.getExportReplyToMessageId(msg.content) || '' const row = [ i + 1, platformMessageId, - replyToMessageId, typeName, msg.isSend ? 1 : 0, talker, - finalMsgText, + msgText, src, this.formatIsoTimestamp(msg.createTime) ]