mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
导出新增位置消息
This commit is contained in:
@@ -665,7 +665,18 @@ class ExportService {
|
|||||||
case 42: return '[名片]'
|
case 42: return '[名片]'
|
||||||
case 43: return '[视频]'
|
case 43: return '[视频]'
|
||||||
case 47: return '[动画表情]'
|
case 47: return '[动画表情]'
|
||||||
case 48: return '[位置]'
|
case 48: {
|
||||||
|
const normalized48 = this.normalizeAppMessageContent(content)
|
||||||
|
const locPoiname = this.extractXmlAttribute(normalized48, 'location', 'poiname') || this.extractXmlValue(normalized48, 'poiname') || this.extractXmlValue(normalized48, 'poiName')
|
||||||
|
const locLabel = this.extractXmlAttribute(normalized48, 'location', 'label') || this.extractXmlValue(normalized48, 'label')
|
||||||
|
const locLat = this.extractXmlAttribute(normalized48, 'location', 'x') || this.extractXmlAttribute(normalized48, 'location', 'latitude')
|
||||||
|
const locLng = this.extractXmlAttribute(normalized48, 'location', 'y') || this.extractXmlAttribute(normalized48, 'location', 'longitude')
|
||||||
|
const locParts: string[] = []
|
||||||
|
if (locPoiname) locParts.push(locPoiname)
|
||||||
|
if (locLabel && locLabel !== locPoiname) locParts.push(locLabel)
|
||||||
|
if (locLat && locLng) locParts.push(`(${locLat},${locLng})`)
|
||||||
|
return locParts.length > 0 ? `[位置] ${locParts.join(' ')}` : '[位置]'
|
||||||
|
}
|
||||||
case 49: {
|
case 49: {
|
||||||
const title = this.extractXmlValue(content, 'title')
|
const title = this.extractXmlValue(content, 'title')
|
||||||
const type = this.extractXmlValue(content, 'type')
|
const type = this.extractXmlValue(content, 'type')
|
||||||
@@ -776,12 +787,15 @@ class ExportService {
|
|||||||
}
|
}
|
||||||
if (localType === 48) {
|
if (localType === 48) {
|
||||||
const normalized = this.normalizeAppMessageContent(safeContent)
|
const normalized = this.normalizeAppMessageContent(safeContent)
|
||||||
const location =
|
const locPoiname = this.extractXmlAttribute(normalized, 'location', 'poiname') || this.extractXmlValue(normalized, 'poiname') || this.extractXmlValue(normalized, 'poiName')
|
||||||
this.extractXmlValue(normalized, 'label') ||
|
const locLabel = this.extractXmlAttribute(normalized, 'location', 'label') || this.extractXmlValue(normalized, 'label')
|
||||||
this.extractXmlValue(normalized, 'poiname') ||
|
const locLat = this.extractXmlAttribute(normalized, 'location', 'x') || this.extractXmlAttribute(normalized, 'location', 'latitude')
|
||||||
this.extractXmlValue(normalized, 'poiName') ||
|
const locLng = this.extractXmlAttribute(normalized, 'location', 'y') || this.extractXmlAttribute(normalized, 'location', 'longitude')
|
||||||
this.extractXmlValue(normalized, 'name')
|
const locParts: string[] = []
|
||||||
return location ? `[定位]${location}` : '[定位]'
|
if (locPoiname) locParts.push(locPoiname)
|
||||||
|
if (locLabel && locLabel !== locPoiname) locParts.push(locLabel)
|
||||||
|
if (locLat && locLng) locParts.push(`(${locLat},${locLng})`)
|
||||||
|
return locParts.length > 0 ? `[位置] ${locParts.join(' ')}` : '[位置]'
|
||||||
}
|
}
|
||||||
if (localType === 50) {
|
if (localType === 50) {
|
||||||
return this.parseVoipMessage(safeContent)
|
return this.parseVoipMessage(safeContent)
|
||||||
@@ -979,6 +993,12 @@ class ExportService {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private extractXmlAttribute(xml: string, tagName: string, attrName: string): string {
|
||||||
|
const tagRegex = new RegExp(`<${tagName}\\s+[^>]*${attrName}\\s*=\\s*"([^"]*)"`, 'i')
|
||||||
|
const match = tagRegex.exec(xml)
|
||||||
|
return match ? match[1] : ''
|
||||||
|
}
|
||||||
|
|
||||||
private cleanSystemMessage(content: string): string {
|
private cleanSystemMessage(content: string): string {
|
||||||
if (!content) return '[系统消息]'
|
if (!content) return '[系统消息]'
|
||||||
|
|
||||||
@@ -2932,7 +2952,7 @@ class ExportService {
|
|||||||
options.displayNamePreference || 'remark'
|
options.displayNamePreference || 'remark'
|
||||||
)
|
)
|
||||||
|
|
||||||
allMessages.push({
|
const msgObj: any = {
|
||||||
localId: allMessages.length + 1,
|
localId: allMessages.length + 1,
|
||||||
createTime: msg.createTime,
|
createTime: msg.createTime,
|
||||||
formattedTime: this.formatTimestamp(msg.createTime),
|
formattedTime: this.formatTimestamp(msg.createTime),
|
||||||
@@ -2944,7 +2964,17 @@ class ExportService {
|
|||||||
senderDisplayName,
|
senderDisplayName,
|
||||||
source,
|
source,
|
||||||
senderAvatarKey: msg.senderUsername
|
senderAvatarKey: msg.senderUsername
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// 位置消息:附加结构化位置字段
|
||||||
|
if (msg.localType === 48) {
|
||||||
|
if (msg.locationLat != null) msgObj.locationLat = msg.locationLat
|
||||||
|
if (msg.locationLng != null) msgObj.locationLng = msg.locationLng
|
||||||
|
if (msg.locationPoiname) msgObj.locationPoiname = msg.locationPoiname
|
||||||
|
if (msg.locationLabel) msgObj.locationLabel = msg.locationLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
allMessages.push(msgObj)
|
||||||
}
|
}
|
||||||
|
|
||||||
allMessages.sort((a, b) => a.createTime - b.createTime)
|
allMessages.sort((a, b) => a.createTime - b.createTime)
|
||||||
|
|||||||
Reference in New Issue
Block a user