feat(staff): StaffList 微信 5 数字改读本地 summary + 日期选择器(Phase A 接线)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-07 18:42:19 +08:00
parent 628659b849
commit 876767cd68
3 changed files with 168 additions and 31 deletions
+24
View File
@@ -17,6 +17,7 @@ import type {
PhoneCall,
Sms,
Staff,
StaffChatStats,
SyncRun,
SyncState,
SyncStatus,
@@ -215,6 +216,28 @@ export function getSms(query: SmsQuery = {}): Promise<Page<Sms>> {
)
}
// ---------------------------------------------------------------------------
// Staff chat stats (微信员工 5 数字 + 客户明细,全本地 message 聚合)
// ---------------------------------------------------------------------------
export interface StaffChatStatsQuery {
owner_account_id: string
/** ms-epoch inclusive 窗口(默认近 3 天,由后端兜底)。 */
start?: number
end?: number
}
export function getStaffChatStats(query: StaffChatStatsQuery): Promise<StaffChatStats> {
return getJson<StaffChatStats>(
'/staff-chat-stats',
clean({
owner_account_id: query.owner_account_id,
start: query.start,
end: query.end,
}),
)
}
// ---------------------------------------------------------------------------
// Sync monitor
// ---------------------------------------------------------------------------
@@ -279,6 +302,7 @@ export type {
PhoneCall,
Sms,
Staff,
StaffChatStats,
SyncRun,
SyncState,
SyncStatus,
+31
View File
@@ -246,3 +246,34 @@ export interface Message {
*/
raw_json?: Record<string, unknown> | null
}
/** 微信员工沟通统计:单个客户聚合行(镜像 backend StaffChatCustomerOut)。 */
export interface StaffChatCustomer {
talker_id: string
friend_name: string
send_count: number
receive_count: number
interaction_days: number
/** 1 = 员工最后发,0 = 客户最后发,null = 最后一条方向未知(不计入两率) */
last_is_send: number | null
/** ms-epoch,最后一条时间 */
last_time: number | null
}
/** 5 个汇总数字(镜像 backend StaffChatStatsSummary)。 */
export interface StaffChatStatsSummary {
chat_count: number
effective_count: number
follow_count: number
last_reply_count: number
no_reply_count: number
}
/** GET /api/staff-chat-stats 响应(镜像 backend StaffChatStatsOut)。 */
export interface StaffChatStats {
owner_account_id: string
start: number
end: number
summary: StaffChatStatsSummary
customers: StaffChatCustomer[]
}