| 123456789101112131415161718192021222324252627282930313233 |
- 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
- machine String? // 客户端提供 : 设备的信息,品牌及系统版本什么的
- 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 IP (fraud detection)
- @@index([ip, clickAt])
-
- // 4. Query clicks by ad type
- @@index([adType, clickAt])
-
- // 5. Global stats by time
- @@index([clickAt])
- @@map("adsClickHistory")
- }
|