chore: 同步工作区(streamer audience、verify-o1-data-smoke)以便推送完整树
Some checks failed
CI / notice (push) Has been cancelled
Some checks failed
CI / notice (push) Has been cancelled
Made-with: Cursor
This commit is contained in:
@@ -46,7 +46,7 @@ export default function StreamerAudiencePage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background text-foreground p-4 pb-24 max-w-3xl mx-auto">
|
<div className="min-h-screen bg-background text-foreground p-4 pb-24 max-w-3xl mx-auto">
|
||||||
<div className="flex items-center gap-3 mb-6">
|
<div className="flex items-center gap-3 mb-6 flex-wrap">
|
||||||
<Button variant="ghost" size="icon" asChild>
|
<Button variant="ghost" size="icon" asChild>
|
||||||
<Link href="/streamer/studio">
|
<Link href="/streamer/studio">
|
||||||
<ArrowLeft className="h-5 w-5" />
|
<ArrowLeft className="h-5 w-5" />
|
||||||
@@ -61,6 +61,9 @@ export default function StreamerAudiencePage() {
|
|||||||
近 {meta?.windowDays ?? "—"} 天 · 来自直播间/推荐流的观看时长、点赞、评论、分享与送礼(脱敏展示)
|
近 {meta?.windowDays ?? "—"} 天 · 来自直播间/推荐流的观看时长、点赞、评论、分享与送礼(脱敏展示)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<Button variant="outline" size="sm" className="ml-auto" onClick={() => void load()} disabled={loading}>
|
||||||
|
刷新
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loading && <p className="text-sm text-muted-foreground">加载中…</p>}
|
{loading && <p className="text-sm text-muted-foreground">加载中…</p>}
|
||||||
|
|||||||
48
scripts/verify-o1-data-smoke.ts
Normal file
48
scripts/verify-o1-data-smoke.ts
Normal file
@@ -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)
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user