| 123456789101112131415161718192021222324252627282930313233343536 |
- model AdsClickHistory {
- id String @id @map("_id") @default(auto()) @db.ObjectId
-
- adsId String @db.ObjectId // 广告 ID
- adType String // 广告类型 (BANNER, STARTUP, etc.)
- adsModuleId String @db.ObjectId // 广告模块 ID
- uid String // 用户设备码 (from JWT)
- ip String // 点击 IP
- appVersion String? // 客户端版本 (optional)
- os String? // iOS / Android / Web (optional)
- channelId String // 用户自带渠道 Id (required)
- machine String // 客户端提供 : 设备的信息,品牌及系统版本什么的 (required)
- clickAt BigInt // 点击时间 (epoch millis)
- // Indexes for common queries:
- // 1. Query all clicks for a specific ad
- @@index([adsId, clickAt])
-
- // 2. Query clicks by user (device)
- @@index([uid, clickAt])
-
- // 3. Query clicks by channel + user (for reporting)
- @@index([channelId, uid, clickAt])
-
- // 4. Query clicks by IP (fraud detection)
- @@index([ip, clickAt])
-
- // 5. Query clicks by ad type
- @@index([adType, clickAt])
-
- // 6. Global stats by time
- @@index([clickAt])
- @@map("adsClickHistory")
- }
|