| 1234567891011121314151617181920212223242526272829303132 |
- model AdsClickHistory {
- id String @id @map("_id") @default(auto()) @db.ObjectId
-
- adsId String @db.ObjectId // 广告 ID
- adType String // 广告类型 (BANNER, STARTUP, etc.)
- channelId String @db.ObjectId // 渠道 ID
- adsModuleId String @db.ObjectId // 广告模块 ID
- uid String // 用户设备码 (from JWT)
- ip String // 点击 IP
- appVersion String? // 客户端版本 (optional)
- os String? // iOS / Android / Web (optional)
- 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")
- }
|