#1043 #1032;修复增量导出意外添加文件的问题;聊天页面支持右键显示资料卡;优化曾经的好友相关算法并新增黑名单;
This commit is contained in:
1 parent
801ed16d5e
commit
b87444dd64
30 files changed
+1615
-145
No files matched your search
@@ -9,6 +9,7 @@ interface ContactExportOptions {
|
||||
friends: boolean
|
||||
groups: boolean
|
||||
officials: boolean
|
||||
blocked?: boolean
|
||||
}
|
||||
selectedUsernames?: string[]
|
||||
}
|
||||
@@ -38,6 +39,7 @@ class ContactExportService {
|
||||
if (c.type === 'friend' && !options.contactTypes.friends) return false
|
||||
if (c.type === 'group' && !options.contactTypes.groups) return false
|
||||
if (c.type === 'official' && !options.contactTypes.officials) return false
|
||||
if (c.type === 'blocked' && !options.contactTypes.blocked) return false
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -99,7 +101,10 @@ class ContactExportService {
|
||||
signature: c.detailDescription,
|
||||
detailDescription: c.detailDescription,
|
||||
region: c.region,
|
||||
type: c.type
|
||||
type: c.type,
|
||||
officialAccountKind: c.officialAccountKind,
|
||||
officialAccountType: c.officialAccountType,
|
||||
typeLabel: this.getTypeLabel(c)
|
||||
}))
|
||||
}
|
||||
fs.writeFileSync(outputPath, JSON.stringify(data, null, 2), 'utf-8')
|
||||
@@ -120,7 +125,7 @@ class ContactExportService {
|
||||
c.description || '',
|
||||
c.detailDescription || '',
|
||||
c.region || '',
|
||||
this.getTypeLabel(c.type)
|
||||
this.getTypeLabel(c)
|
||||
])
|
||||
const escapeCell = (value: unknown) => `"${String(value ?? '').replace(/"/g, '""')}"`
|
||||
|
||||
@@ -170,11 +175,18 @@ class ContactExportService {
|
||||
fs.writeFileSync(outputPath, vcards.join('\r\n\r\n'), 'utf-8')
|
||||
}
|
||||
|
||||
private getTypeLabel(type: string): string {
|
||||
private getTypeLabel(contactOrType: any): string {
|
||||
const type = typeof contactOrType === 'string' ? contactOrType : String(contactOrType?.type || '')
|
||||
if (type === 'official' && typeof contactOrType !== 'string') {
|
||||
if (contactOrType.officialAccountKind === 'service') return '服务号'
|
||||
if (contactOrType.officialAccountKind === 'enterprise') return '企业号'
|
||||
return '公众号'
|
||||
}
|
||||
switch (type) {
|
||||
case 'friend': return '好友'
|
||||
case 'group': return '群聊'
|
||||
case 'official': return '公众号'
|
||||
case 'blocked': return '黑名单'
|
||||
default: return '其他'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user