From b6eea3070a2fa84d6e7ec849beb8d889e60701bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Tue, 25 Aug 2026 10:24:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(staff):=20=E5=BC=B9=E6=A1=86=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=BE=AE=E4=BF=A1/=E5=91=98=E5=B7=A5=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=88=97=E6=94=B9=E5=AF=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?(=E5=A4=B4=E5=83=8F+=E6=98=B5=E7=A7=B0+ID+=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E5=A7=93=E5=90=8D,=E5=AF=B9=E9=BD=90=E4=BA=91=E5=AE=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- .../app/api/routers/staff_chat_stats.py | 15 ++++++----- yunke-server/app/api/schemas.py | 2 ++ yunkes/src/api/types.ts | 2 ++ yunkes/src/components/YkStaffDetailModal.vue | 25 ++++++++++++++++++- yunkes/src/views/StaffList.vue | 17 +++++++++---- 5 files changed, 49 insertions(+), 12 deletions(-) diff --git a/yunke-server/app/api/routers/staff_chat_stats.py b/yunke-server/app/api/routers/staff_chat_stats.py index 5223258..cdbbf50 100644 --- a/yunke-server/app/api/routers/staff_chat_stats.py +++ b/yunke-server/app/api/routers/staff_chat_stats.py @@ -81,7 +81,7 @@ async def _aggregate(session: AsyncSession, owner: str, start: int, end: int) -> return agg_rows, last_map -async def _customer_names(session: AsyncSession, owner: str, talker_ids: list[str]) -> dict[str, str]: +async def _customer_names(session: AsyncSession, owner: str, talker_ids: list[str]) -> dict[str, tuple[str, str, str]]: if not talker_ids: return {} stmt = sa.select( @@ -89,15 +89,16 @@ async def _customer_names(session: AsyncSession, owner: str, talker_ids: list[st Customer.friend_remark, Customer.friend_nickname, Customer.real_name, + Customer.head_image_url, ).where( Customer.channel == "wechat", Customer.owner_account_id == owner, Customer.friend_id.in_(talker_ids), ) - names: dict[str, str] = {} - for fid, remark, nick, real in (await session.execute(stmt)).all(): - names[fid] = remark or nick or real or fid - return names + info: dict[str, tuple[str, str, str]] = {} + for fid, remark, nick, real, head in (await session.execute(stmt)).all(): + info[fid] = (remark or nick or real or fid, real or "", head or "") + return info @router.get("/staff-chat-stats") @@ -124,7 +125,9 @@ async def get_staff_chat_stats( customers.append( StaffChatCustomerOut( talker_id=tid, - friend_name=names.get(tid, tid), + friend_name=(names.get(tid) or (tid, "", ""))[0], + real_name=(names.get(tid) or ("", "", ""))[1] or None, + head_image_url=(names.get(tid) or ("", "", ""))[2] or None, send_count=int(r.send_count or 0), receive_count=int(r.receive_count or 0), interaction_days=int(r.interaction_days or 0), diff --git a/yunke-server/app/api/schemas.py b/yunke-server/app/api/schemas.py index f307351..5a3c110 100644 --- a/yunke-server/app/api/schemas.py +++ b/yunke-server/app/api/schemas.py @@ -366,6 +366,8 @@ class StaffChatCustomerOut(BaseModel): talker_id: str friend_name: str # remark > nickname > real_name > talker_id + real_name: str | None = None # 真实姓名(弹框客户微信列显示) + head_image_url: str | None = None # 头像(弹框客户微信列显示) send_count: int # 员工发出(is_send True) receive_count: int # 客户发出(is_send False) interaction_days: int # 窗口内不同日期数 diff --git a/yunkes/src/api/types.ts b/yunkes/src/api/types.ts index aca7fd8..7ab4cfb 100644 --- a/yunkes/src/api/types.ts +++ b/yunkes/src/api/types.ts @@ -316,6 +316,8 @@ export interface Message { export interface StaffChatCustomer { talker_id: string friend_name: string + real_name?: string | null + head_image_url?: string | null send_count: number receive_count: number interaction_days: number diff --git a/yunkes/src/components/YkStaffDetailModal.vue b/yunkes/src/components/YkStaffDetailModal.vue index a5b3ec8..cd02869 100644 --- a/yunkes/src/components/YkStaffDetailModal.vue +++ b/yunkes/src/components/YkStaffDetailModal.vue @@ -79,7 +79,30 @@ watch( :formatter="c.formatter" show-overflow-tooltip > -