My Stores — 计算配置

Source of truth: studio-website-monorepo/apps/api/src/routes/v3/dashboard-multi-store.ts last_verified: 2026-05-29

My Stores 的全部数据来自 GET /v3/dashboard/multi-store?period=yesterday|last-week|this-month|last-month。该 endpoint 聚合用户所有已激活门店(WHERE activated_at IS NOT NULL)的 calls 和 tasks 数据,返回 per-store 明细 + totals。


Call Activity Tab

所有 call 指标排除 voicemail(call_state IS DISTINCT FROM 'voicemail')。

指标产品定义SQL 口径来源表状态
Call Volume选定时段内该门店的通话总数COUNT(*)calls✅ 已接线
out / in 拆分外呼 vs 来电COUNT(*) FILTER (WHERE direction = 'Outbound');in = total - outboundcalls✅ 已接线
Intro Calls涉及 intro booking 的通话数COUNT(*) FILTER (WHERE primary_subcategory = 'intro_booking')calls✅ 已接线
Membership Calls会员销售成功的通话数COUNT(*) FILTER (WHERE primary_category = 'revenue_impacting' AND primary_subcategory IN ('membership_purchase_related', 'reactivation_purchase') AND primary_outcome_result = 'success')calls✅ 已接线
Cancellation Calls涉及会员取消的通话数COUNT(*) FILTER (WHERE primary_subcategory = 'membership_cancel')calls✅ 已接线
Cancel Saved(通话维度)挽留成功的取消通话数(与 Task Outcomes 表的 task 维度 Cancel Saved 是两个不同口径)COUNT(*) FILTER (WHERE primary_subcategory = 'membership_cancel' AND primary_outcome_result = 'retained')calls✅ 已接线

Membership Calls 口径注意:multi-store endpoint 统计的是"成功销售的会员通话"(需要 outcome_result = 'success'),不是所有涉及会员的通话。MEMBERSHIP_SALES_SUBCATEGORIES 包含 membership_purchase_relatedreactivation_purchase 两个子分类。


Task Outcomes Tab

指标产品定义SQL 口径来源表状态
Closed Tasks选定时段内关闭的任务数COUNT(*) FILTER (WHERE closed_at >= start AND closed_at < end)tasks✅ 已接线
Intro Booked完成的 intro booking 任务数需按 type_category + close_result 拆分tasks⚠️ 待开发(当前 endpoint 无 type_category 明细)
Membership Sold完成的会员销售任务数同上tasks⚠️ 待开发
Cancel Saved挽留成功的取消任务数同上tasks⚠️ 待开发
Core Productivity三类核心任务的完成率(completed Intro + Membership + Cancel Save) / (created 同三类)tasks⚠️ 待开发(依赖 type_category 明细)

Core Productivity 只算 3 类:Intro Booking + Membership Sold + Cancel Saved。不包含全部 9 类 type_category。当前 multi-store endpoint 只返回 tasksCreated / tasksClosed / tasksOverdue 汇总,需扩展返回 per-type_category 明细。

⚠️ 指标命名「Core Productivity」暂定,待团队确认(2026-05-27 会议)。


趋势计算

endpoint 仅对 Call Volume(total_calls)计算趋势 —— 同时查询上期(同长度前一时段)的通话总数,计算 delta(其余 calls / tasks 指标当前 endpoint 不返回趋势):

delta = round((当期 - 上期) / 上期 × 100)   // 四舍五入为整数百分比

上期为 0 时返回 null(无论当期是否 > 0)。趋势方向:up / down / flat