feat(chat): getSessions + ChatSidebar 会话列表组件
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
Message,
|
||||
Page,
|
||||
PhoneCall,
|
||||
SessionList,
|
||||
Sms,
|
||||
Staff,
|
||||
StaffChatStats,
|
||||
@@ -238,6 +239,22 @@ export function getStaffChatStats(query: StaffChatStatsQuery): Promise<StaffChat
|
||||
)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Chat sessions (账号会话列表:好友+群,今日消息数+最近联系时间)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface SessionQuery {
|
||||
owner_account_id: string
|
||||
channel?: Channel
|
||||
}
|
||||
|
||||
export function getSessions(query: SessionQuery): Promise<SessionList> {
|
||||
return getJson<SessionList>(
|
||||
'/sessions',
|
||||
clean({ owner_account_id: query.owner_account_id, channel: query.channel }),
|
||||
)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Sync monitor
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -300,6 +317,7 @@ export type {
|
||||
Message,
|
||||
Page,
|
||||
PhoneCall,
|
||||
SessionList,
|
||||
Sms,
|
||||
Staff,
|
||||
StaffChatStats,
|
||||
|
||||
@@ -277,3 +277,21 @@ export interface StaffChatStats {
|
||||
summary: StaffChatStatsSummary
|
||||
customers: StaffChatCustomer[]
|
||||
}
|
||||
|
||||
/** 账号会话列表一行(好友或群),镜像 backend SessionOut。 */
|
||||
export interface ChatSession {
|
||||
type: 'friend' | 'group'
|
||||
talker_id?: string | null
|
||||
room_id?: string | null
|
||||
name?: string | null
|
||||
avatar?: string | null
|
||||
today_count: number
|
||||
last_chat_time?: number | null
|
||||
}
|
||||
|
||||
export interface SessionList {
|
||||
owner_account_id: string
|
||||
channel: string
|
||||
today_start: number
|
||||
sessions: ChatSession[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user