|
|
|
|
@ -41,6 +41,7 @@ type TicketGrabScheduleCountBlock = ScheduleCountBlock & {
|
|
|
|
|
booked_people: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type VenueNameRow = { id: number; name: string }
|
|
|
|
|
type LivePeopleRankRow = { venue_id: number; venue_name: string; live_count: number }
|
|
|
|
|
type ActivityPublishRankRow = {
|
|
|
|
|
venue_id: number
|
|
|
|
|
@ -59,6 +60,7 @@ const stats = ref({
|
|
|
|
|
people_counting_venue_ids: [] as number[],
|
|
|
|
|
show_venue_people_stats: false,
|
|
|
|
|
},
|
|
|
|
|
venue_names: [] as VenueNameRow[],
|
|
|
|
|
summary: {
|
|
|
|
|
activity_sessions: 0,
|
|
|
|
|
venues_count: 0,
|
|
|
|
|
@ -173,6 +175,33 @@ function applyVenuePcRangeToday() {
|
|
|
|
|
|
|
|
|
|
type DashboardVenuePcRow = Pick<HikVenueRangeTotalRow, 'venueId' | 'venueName' | 'enter'>
|
|
|
|
|
|
|
|
|
|
/** 后台场馆 id → 当前名称;用于覆盖客流接口里的旧 venueName */
|
|
|
|
|
const systemVenueNameById = computed(() => {
|
|
|
|
|
const m = new Map<string, string>()
|
|
|
|
|
const remember = (id: unknown, name: unknown) => {
|
|
|
|
|
const key = String(id ?? '').trim()
|
|
|
|
|
const label = String(name ?? '').trim()
|
|
|
|
|
if (!key || !label) return
|
|
|
|
|
m.set(key, label)
|
|
|
|
|
}
|
|
|
|
|
for (const row of stats.value.venue_names ?? []) remember(row.id, row.name)
|
|
|
|
|
for (const row of stats.value.live_people_ranking ?? []) remember(row.venue_id, row.venue_name)
|
|
|
|
|
for (const row of stats.value.activity_publish_ranking ?? []) remember(row.venue_id, row.venue_name)
|
|
|
|
|
return m
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function overlaySystemVenueName(venueId: string | number | undefined, hikName?: string): string {
|
|
|
|
|
const id = String(venueId ?? '').trim()
|
|
|
|
|
const fromSys = systemVenueNameById.value.get(id)
|
|
|
|
|
if (fromSys) return fromSys
|
|
|
|
|
const n = Number(id)
|
|
|
|
|
if (Number.isInteger(n) && n > 0) {
|
|
|
|
|
const byNum = systemVenueNameById.value.get(String(n))
|
|
|
|
|
if (byNum) return byNum
|
|
|
|
|
}
|
|
|
|
|
return (hikName || '').trim() || id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 区间内优先用 venuesRangeTotals;单日或无区间汇总时用 venues(当日快照);按「进入人数」降序 */
|
|
|
|
|
function parseVenuePcRowsFromResponse(p: HikPeopleCountingResponse | null): DashboardVenuePcRow[] {
|
|
|
|
|
if (!p || p.code !== 200) return []
|
|
|
|
|
@ -181,7 +210,7 @@ function parseVenuePcRowsFromResponse(p: HikPeopleCountingResponse | null): Dash
|
|
|
|
|
if (Array.isArray(rangeTotals) && rangeTotals.length > 0) {
|
|
|
|
|
raw = rangeTotals.map((row) => ({
|
|
|
|
|
venueId: row.venueId,
|
|
|
|
|
venueName: row.venueName,
|
|
|
|
|
venueName: overlaySystemVenueName(row.venueId, row.venueName),
|
|
|
|
|
enter: Number(row.enter) || 0,
|
|
|
|
|
}))
|
|
|
|
|
} else {
|
|
|
|
|
@ -189,7 +218,7 @@ function parseVenuePcRowsFromResponse(p: HikPeopleCountingResponse | null): Dash
|
|
|
|
|
if (!Array.isArray(v) || v.length === 0) return []
|
|
|
|
|
raw = v.map((x) => ({
|
|
|
|
|
venueId: x.venueId,
|
|
|
|
|
venueName: x.venueName,
|
|
|
|
|
venueName: overlaySystemVenueName(x.venueId, x.venueName),
|
|
|
|
|
enter: Number(x.enter) || 0,
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
@ -786,6 +815,7 @@ async function loadStats() {
|
|
|
|
|
...(data.ticket_grab_schedule_counts ?? {}),
|
|
|
|
|
},
|
|
|
|
|
pending_audits: data.pending_audits ?? null,
|
|
|
|
|
venue_names: Array.isArray(data.venue_names) ? data.venue_names : stats.value.venue_names,
|
|
|
|
|
activity_publish_ranking: Array.isArray(data.activity_publish_ranking)
|
|
|
|
|
? data.activity_publish_ranking
|
|
|
|
|
: stats.value.activity_publish_ranking,
|
|
|
|
|
|