mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
群聊分析ui调整
This commit is contained in:
@@ -3,6 +3,7 @@ import * as path from 'path'
|
|||||||
import ExcelJS from 'exceljs'
|
import ExcelJS from 'exceljs'
|
||||||
import { ConfigService } from './config'
|
import { ConfigService } from './config'
|
||||||
import { wcdbService } from './wcdbService'
|
import { wcdbService } from './wcdbService'
|
||||||
|
import { chatService } from './chatService'
|
||||||
|
|
||||||
export interface GroupChatInfo {
|
export interface GroupChatInfo {
|
||||||
username: string
|
username: string
|
||||||
@@ -240,23 +241,38 @@ class GroupAnalyticsService {
|
|||||||
.map((row) => row.username || row.user_name || row.userName || '')
|
.map((row) => row.username || row.user_name || row.userName || '')
|
||||||
.filter((username) => username.includes('@chatroom'))
|
.filter((username) => username.includes('@chatroom'))
|
||||||
|
|
||||||
const [displayNames, avatarUrls, memberCounts] = await Promise.all([
|
const [memberCounts, contactInfo] = await Promise.all([
|
||||||
wcdbService.getDisplayNames(groupIds),
|
wcdbService.getGroupMemberCounts(groupIds),
|
||||||
wcdbService.getAvatarUrls(groupIds),
|
chatService.enrichSessionsContactInfo(groupIds)
|
||||||
wcdbService.getGroupMemberCounts(groupIds)
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
let fallbackNames: { success: boolean; map?: Record<string, string> } | null = null
|
||||||
|
let fallbackAvatars: { success: boolean; map?: Record<string, string> } | null = null
|
||||||
|
if (!contactInfo.success || !contactInfo.contacts) {
|
||||||
|
const [displayNames, avatarUrls] = await Promise.all([
|
||||||
|
wcdbService.getDisplayNames(groupIds),
|
||||||
|
wcdbService.getAvatarUrls(groupIds)
|
||||||
|
])
|
||||||
|
fallbackNames = displayNames
|
||||||
|
fallbackAvatars = avatarUrls
|
||||||
|
}
|
||||||
|
|
||||||
const groups: GroupChatInfo[] = []
|
const groups: GroupChatInfo[] = []
|
||||||
for (const groupId of groupIds) {
|
for (const groupId of groupIds) {
|
||||||
|
const contact = contactInfo.success && contactInfo.contacts ? contactInfo.contacts[groupId] : undefined
|
||||||
|
const displayName = contact?.displayName ||
|
||||||
|
(fallbackNames && fallbackNames.success && fallbackNames.map ? (fallbackNames.map[groupId] || '') : '') ||
|
||||||
|
groupId
|
||||||
|
const avatarUrl = contact?.avatarUrl ||
|
||||||
|
(fallbackAvatars && fallbackAvatars.success && fallbackAvatars.map ? fallbackAvatars.map[groupId] : undefined)
|
||||||
|
|
||||||
groups.push({
|
groups.push({
|
||||||
username: groupId,
|
username: groupId,
|
||||||
displayName: displayNames.success && displayNames.map
|
displayName,
|
||||||
? (displayNames.map[groupId] || groupId)
|
|
||||||
: groupId,
|
|
||||||
memberCount: memberCounts.success && memberCounts.map && typeof memberCounts.map[groupId] === 'number'
|
memberCount: memberCounts.success && memberCounts.map && typeof memberCounts.map[groupId] === 'number'
|
||||||
? memberCounts.map[groupId]
|
? memberCounts.map[groupId]
|
||||||
: 0,
|
: 0,
|
||||||
avatarUrl: avatarUrls.success && avatarUrls.map ? avatarUrls.map[groupId] : undefined
|
avatarUrl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -333,7 +333,7 @@
|
|||||||
.group-avatar {
|
.group-avatar {
|
||||||
width: 44px;
|
width: 44px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
border-radius: 50%;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
@@ -346,11 +346,11 @@
|
|||||||
.avatar-placeholder {
|
.avatar-placeholder {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
background: var(--bg-tertiary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #fff;
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@
|
|||||||
.skeleton-avatar {
|
.skeleton-avatar {
|
||||||
width: 44px;
|
width: 44px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
border-radius: 50%;
|
border-radius: 8px;
|
||||||
background: var(--bg-tertiary);
|
background: var(--bg-tertiary);
|
||||||
animation: pulse 1.5s infinite;
|
animation: pulse 1.5s infinite;
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@
|
|||||||
.group-avatar.large {
|
.group-avatar.large {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
border-radius: 50%;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0 auto 16px;
|
margin: 0 auto 16px;
|
||||||
|
|
||||||
@@ -513,11 +513,11 @@
|
|||||||
.avatar-placeholder {
|
.avatar-placeholder {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
background: var(--bg-tertiary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #fff;
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user