fix(customers): WA客户破1万上限(逐员工uid过滤,8585→11931全量)+双渠道页脚云客口径+消息同步刷新最近沟通时间

- wa-friends 逐员工抓取:全局查询~1万行硬上限(云客11931只翻到10000),
  uid=员工WA号过滤(真机验证 declared 1145→1149),total-aware翻页
- declared-total 分渠道:Σ wechat/whatsapp_account.contacts_num(8590/11915)
- 消息增量同步顺带刷新 customer.last_chat_time(云客列表按最近沟通实时
  排序,快照每日一次导致顺序滞后;微信1:1+WA都加)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-20 14:04:06 +08:00
parent fd3cf0003b
commit edca9b4c77
5 changed files with 187 additions and 62 deletions
+7 -2
View File
@@ -48,8 +48,13 @@ export interface CustomerQuery {
last_chat_since?: number
}
export function getCustomerDeclaredTotal(): Promise<{ declared_total: number; account_count: number }> {
return getJson<{ declared_total: number; account_count: number }>('/customers/declared-total')
export interface DeclaredTotals {
wechat: { declared_total: number; account_count: number }
whatsapp: { declared_total: number; account_count: number }
}
export function getCustomerDeclaredTotal(): Promise<DeclaredTotals> {
return getJson<DeclaredTotals>('/customers/declared-total')
}
export function getCustomers(query: CustomerQuery = {}): Promise<Page<Customer>> {
+8 -5
View File
@@ -39,15 +39,18 @@ function freshTabState(): TabState {
return { items: [], total: 0, page: 1, pageSize: 10, loading: false, errorMsg: null, loaded: false }
}
/** 云客口径微信客户合计(Σ员工好友数声明值,含云客索引重复;页脚对齐云客)。 */
const declaredTotal = ref<number | null>(null)
/** 云客口径客户合计(分渠道,Σ员工好友数声明值,含云客索引重复;页脚对齐云客)。 */
const declaredTotals = ref<{ wechat: number | null; whatsapp: number | null }>({ wechat: null, whatsapp: null })
async function loadDeclaredTotal(): Promise<void> {
try {
const r = await getCustomerDeclaredTotal()
declaredTotal.value = r.declared_total
declaredTotals.value = {
wechat: r.wechat.declared_total,
whatsapp: r.whatsapp.declared_total,
}
} catch {
declaredTotal.value = null // 回退真实 total
declaredTotals.value = { wechat: null, whatsapp: null } // 回退真实 total
}
}
@@ -368,7 +371,7 @@ onMounted(() => {
<div>
<h2 style="margin: 0 0 4px; font-size: 16px">{{ activeTab === 'wechat' ? '微信' : 'WhatsApp' }}客户列表</h2>
<span class="yk-customers__sub">
共 {{ activeTab === 'wechat' && declaredTotal !== null ? declaredTotal : tabState[activeTab].total }} 条
共 {{ declaredTotals[activeTab] !== null ? declaredTotals[activeTab] : tabState[activeTab].total }} 条
<template v-if="departmentName"> · 部门:{{ departmentName }}</template>
<template v-if="ownerId"> · 员工账号:{{ ownerId }}</template>
</span>