From a043367e1d19e7a8cc349d52179d240ea57b56b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Tue, 14 Apr 2026 18:52:51 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=90=8C=E6=AD=A5=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8C=BA=EF=BC=88streamer=20audience=E3=80=81verify-o1-data-sm?= =?UTF-8?q?oke=EF=BC=89=E4=BB=A5=E4=BE=BF=E6=8E=A8=E9=80=81=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- app/streamer/audience/page.tsx | 5 +++- scripts/verify-o1-data-smoke.ts | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scripts/verify-o1-data-smoke.ts diff --git a/app/streamer/audience/page.tsx b/app/streamer/audience/page.tsx index cdb2e21..ef95c0b 100644 --- a/app/streamer/audience/page.tsx +++ b/app/streamer/audience/page.tsx @@ -46,7 +46,7 @@ export default function StreamerAudiencePage() { return (
-
+
+
{loading &&

加载中…

} diff --git a/scripts/verify-o1-data-smoke.ts b/scripts/verify-o1-data-smoke.ts new file mode 100644 index 0000000..4df01ea --- /dev/null +++ b/scripts/verify-o1-data-smoke.ts @@ -0,0 +1,48 @@ +/** + * O1 数据层冒烟:集合、索引、写入与 admin 查询路径(WM-O1) + * 执行:cd 玩值电竞App && pnpm exec tsx scripts/verify-o1-data-smoke.ts + */ +import { ObjectId } from "mongodb" +import { getDb, closeMongo } from "../lib/mongodb/client" +import { COLLECTIONS } from "../lib/db/mongo/collections" + +async function main() { + const db = await getDb() + const collName = COLLECTIONS.userJourneyEvents + const idx = await db.collection(collName).indexes() + const hasStreamerIdx = idx.some((i) => i.name === "props_streamerId_occurredAt_-1") + console.log("[indexes] userJourneyEvents props_streamerId:", hasStreamerIdx ? "OK" : "MISSING") + + const testUserId = new ObjectId() + const sid = "69a03c9d0c31b38c1d842ae6" + const now = new Date() + await db.collection(collName).insertOne({ + userId: testUserId, + sessionId: "smoke_sess", + clientEventId: `smoke_${Date.now()}`, + eventName: "live.audience.like", + properties: { streamerId: sid, surface: "smoke" }, + source: "app", + occurredAt: now, + receivedAt: now, + }) + const found = await db + .collection(collName) + .find({ userId: testUserId }) + .sort({ occurredAt: -1 }) + .limit(3) + .toArray() + console.log("[mongo] inserted + read back:", found.length, "events") + + const rfm = await db.collection(COLLECTIONS.rfmRuleSets).countDocuments() + const scores = await db.collection(COLLECTIONS.rfmUserScores).countDocuments() + console.log("[mongo] rfmRuleSets count:", rfm, "rfmUserScores:", scores) + + await closeMongo() + console.log("[done] test userId for manual admin check:", testUserId.toString()) +} + +main().catch((e) => { + console.error(e) + process.exit(1) +})