This commit is contained in:
wchino
2026-06-13 17:38:25 +08:00
parent e7e938f261
commit 7b33d9f9fa
190 changed files with 23222 additions and 4336 deletions

View File

@@ -10,19 +10,19 @@ datasource db {
// ============ Users & Auth ============
model User {
id BigInt @id @default(autoincrement())
username String @unique @db.VarChar(64)
userType String @map("user_type") @db.VarChar(20)
status String @default("ACTIVE") @db.VarChar(20)
parentId BigInt? @map("parent_id")
agentLevel Int? @map("agent_level")
locale String @default("en-US") @db.VarChar(10)
inviteCode String? @unique @map("invite_code") @db.VarChar(16)
inviteSponsorId BigInt? @map("invite_sponsor_id")
usedInviteId BigInt? @map("used_invite_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
id BigInt @id @default(autoincrement())
username String @unique @db.VarChar(64)
userType String @map("user_type") @db.VarChar(20)
status String @default("ACTIVE") @db.VarChar(20)
parentId BigInt? @map("parent_id")
agentLevel Int? @map("agent_level")
locale String @default("en-US") @db.VarChar(10)
inviteCode String? @unique @map("invite_code") @db.VarChar(16)
inviteSponsorId BigInt? @map("invite_sponsor_id")
usedInviteId BigInt? @map("used_invite_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
auth UserAuth?
wallet Wallet?
@@ -30,14 +30,14 @@ model User {
adminRole AdminUserRole?
bets Bet[]
preferences UserPreference?
depositOrders DepositOrder[] @relation("PlayerDepositOrders")
depositOrders DepositOrder[] @relation("PlayerDepositOrders")
parent User? @relation("UserHierarchy", fields: [parentId], references: [id])
children User[] @relation("UserHierarchy")
inviteSponsor User? @relation("InviteSponsor", fields: [inviteSponsorId], references: [id])
invitedPlayers User[] @relation("InviteSponsor")
usedInvite UserInvite? @relation("UsedInvite", fields: [usedInviteId], references: [id])
invites UserInvite[] @relation("UserInvites")
parent User? @relation("UserHierarchy", fields: [parentId], references: [id])
children User[] @relation("UserHierarchy")
inviteSponsor User? @relation("InviteSponsor", fields: [inviteSponsorId], references: [id])
invitedPlayers User[] @relation("InviteSponsor")
usedInvite UserInvite? @relation("UsedInvite", fields: [usedInviteId], references: [id])
invites UserInvite[] @relation("UserInvites")
@@index([userType])
@@index([parentId])
@@ -56,8 +56,8 @@ model UserInvite {
revokedAt DateTime? @map("revoked_at")
cashbackRate Decimal? @map("cashback_rate") @db.Decimal(8, 4)
sponsor User @relation("UserInvites", fields: [sponsorId], references: [id])
registrations User[] @relation("UsedInvite")
sponsor User @relation("UserInvites", fields: [sponsorId], references: [id])
registrations User[] @relation("UsedInvite")
@@index([sponsorId])
@@index([status])
@@ -66,16 +66,16 @@ model UserInvite {
}
model UserAuth {
id BigInt @id @default(autoincrement())
userId BigInt @unique @map("user_id")
passwordHash String @map("password_hash") @db.VarChar(255)
loginFailCount Int @default(0) @map("login_fail_count")
lockedUntil DateTime? @map("locked_until")
lastLoginAt DateTime? @map("last_login_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
userId BigInt @unique @map("user_id")
passwordHash String @map("password_hash") @db.VarChar(255)
loginFailCount Int @default(0) @map("login_fail_count")
lockedUntil DateTime? @map("locked_until")
lastLoginAt DateTime? @map("last_login_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id])
user User @relation(fields: [userId], references: [id])
@@map("user_auth")
}
@@ -95,18 +95,18 @@ model UserPreference {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id])
user User @relation(fields: [userId], references: [id])
@@index([phoneCountryDial, phoneLocal])
@@map("user_preferences")
}
model Role {
id BigInt @id @default(autoincrement())
code String @unique @db.VarChar(64)
name String @db.VarChar(128)
description String? @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
code String @unique @db.VarChar(64)
name String @db.VarChar(128)
description String? @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at")
permissions RolePermission[]
adminUsers AdminUserRole[]
@@ -115,23 +115,23 @@ model Role {
}
model Permission {
id BigInt @id @default(autoincrement())
code String @unique @db.VarChar(128)
name String @db.VarChar(128)
module String @db.VarChar(64)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
code String @unique @db.VarChar(128)
name String @db.VarChar(128)
module String @db.VarChar(64)
createdAt DateTime @default(now()) @map("created_at")
roles RolePermission[]
roles RolePermission[]
@@map("permissions")
}
model RolePermission {
roleId BigInt @map("role_id")
permissionId BigInt @map("permission_id")
roleId BigInt @map("role_id")
permissionId BigInt @map("permission_id")
role Role @relation(fields: [roleId], references: [id])
permission Permission @relation(fields: [permissionId], references: [id])
role Role @relation(fields: [roleId], references: [id])
permission Permission @relation(fields: [permissionId], references: [id])
@@id([roleId, permissionId])
@@map("role_permissions")
@@ -142,8 +142,8 @@ model AdminUserRole {
roleId BigInt @map("role_id")
createdAt DateTime @default(now()) @map("created_at")
user User @relation(fields: [userId], references: [id])
role Role @relation(fields: [roleId], references: [id])
user User @relation(fields: [userId], references: [id])
role Role @relation(fields: [roleId], references: [id])
@@map("admin_user_roles")
}
@@ -151,23 +151,23 @@ model AdminUserRole {
// ============ Agent ============
model AgentProfile {
id BigInt @id @default(autoincrement())
userId BigInt @unique @map("user_id")
level Int
parentAgentId BigInt? @map("parent_agent_id")
creditLimit Decimal @default(0) @map("credit_limit") @db.Decimal(18, 4)
usedCredit Decimal @default(0) @map("used_credit") @db.Decimal(18, 4)
directPlayerLiability Decimal @default(0) @map("direct_player_liability") @db.Decimal(18, 4)
childAgentExposure Decimal @default(0) @map("child_agent_exposure") @db.Decimal(18, 4)
status String @default("ACTIVE") @db.VarChar(20)
maxSingleDeposit Decimal? @map("max_single_deposit") @db.Decimal(18, 4)
maxDailyDeposit Decimal? @map("max_daily_deposit") @db.Decimal(18, 4)
cashbackRate Decimal @default(0) @map("cashback_rate") @db.Decimal(8, 4)
blockDirectPlayerLogin Boolean @default(false) @map("block_direct_player_login")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
userId BigInt @unique @map("user_id")
level Int
parentAgentId BigInt? @map("parent_agent_id")
creditLimit Decimal @default(0) @map("credit_limit") @db.Decimal(18, 4)
usedCredit Decimal @default(0) @map("used_credit") @db.Decimal(18, 4)
directPlayerLiability Decimal @default(0) @map("direct_player_liability") @db.Decimal(18, 4)
childAgentExposure Decimal @default(0) @map("child_agent_exposure") @db.Decimal(18, 4)
status String @default("ACTIVE") @db.VarChar(20)
maxSingleDeposit Decimal? @map("max_single_deposit") @db.Decimal(18, 4)
maxDailyDeposit Decimal? @map("max_daily_deposit") @db.Decimal(18, 4)
cashbackRate Decimal @default(0) @map("cashback_rate") @db.Decimal(8, 4)
blockDirectPlayerLogin Boolean @default(false) @map("block_direct_player_login")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id])
user User @relation(fields: [userId], references: [id])
@@index([parentAgentId])
@@map("agent_profiles")
@@ -215,8 +215,8 @@ model Wallet {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id])
transactions WalletTransaction[]
user User @relation(fields: [userId], references: [id])
transactions WalletTransaction[]
@@map("wallets")
}
@@ -234,11 +234,12 @@ model WalletTransaction {
frozenAfter Decimal @map("frozen_after") @db.Decimal(18, 4)
referenceType String? @map("reference_type") @db.VarChar(32)
referenceId String? @map("reference_id") @db.VarChar(64)
businessKey String? @unique @map("business_key") @db.VarChar(128)
operatorId BigInt? @map("operator_id")
remark String? @db.VarChar(500)
createdAt DateTime @default(now()) @map("created_at")
wallet Wallet @relation(fields: [walletId], references: [id])
wallet Wallet @relation(fields: [walletId], references: [id])
@@index([userId])
@@index([walletId])
@@ -259,7 +260,7 @@ model League {
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
matches Match[]
matches Match[]
@@map("leagues")
}
@@ -296,41 +297,40 @@ model EntityTranslation {
}
model Match {
id BigInt @id @default(autoincrement())
sportType String @default("FOOTBALL") @map("sport_type") @db.VarChar(20)
leagueId BigInt @map("league_id")
homeTeamId BigInt @map("home_team_id")
awayTeamId BigInt @map("away_team_id")
startTime DateTime @map("start_time")
status String @default("DRAFT") @db.VarChar(32)
isHot Boolean @default(false) @map("is_hot")
displayOrder Int @default(0) @map("display_order")
publishTime DateTime? @map("publish_time")
closeTime DateTime? @map("close_time")
isOutright Boolean @default(false) @map("is_outright")
officialMatchNo Int? @map("official_match_no")
stage String? @db.VarChar(32)
groupName String? @map("group_name") @db.VarChar(8)
liveMatchId BigInt? @unique @map("live_match_id")
additionMatchId BigInt? @map("addition_match_id")
channelId String? @map("channel_id") @db.VarChar(64)
matchName String? @map("match_name") @db.VarChar(200)
venueJson Json? @map("venue_json")
kickoffJson Json? @map("kickoff_json")
externalStatus String? @map("external_status") @db.VarChar(32)
correctScoreEnabled Boolean @default(true) @map("correct_score_enabled")
createdBy BigInt? @map("created_by")
updatedBy BigInt? @map("updated_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
id BigInt @id @default(autoincrement())
sportType String @default("FOOTBALL") @map("sport_type") @db.VarChar(20)
leagueId BigInt @map("league_id")
homeTeamId BigInt @map("home_team_id")
awayTeamId BigInt @map("away_team_id")
startTime DateTime @map("start_time")
status String @default("DRAFT") @db.VarChar(32)
isHot Boolean @default(false) @map("is_hot")
displayOrder Int @default(0) @map("display_order")
publishTime DateTime? @map("publish_time")
closeTime DateTime? @map("close_time")
isOutright Boolean @default(false) @map("is_outright")
officialMatchNo Int? @map("official_match_no")
stage String? @db.VarChar(32)
groupName String? @map("group_name") @db.VarChar(8)
liveMatchId BigInt? @unique @map("live_match_id")
additionMatchId BigInt? @map("addition_match_id")
channelId String? @map("channel_id") @db.VarChar(64)
matchName String? @map("match_name") @db.VarChar(200)
venueJson Json? @map("venue_json")
kickoffJson Json? @map("kickoff_json")
externalStatus String? @map("external_status") @db.VarChar(32)
createdBy BigInt? @map("created_by")
updatedBy BigInt? @map("updated_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
league League @relation(fields: [leagueId], references: [id])
homeTeam Team @relation("HomeTeam", fields: [homeTeamId], references: [id])
awayTeam Team @relation("AwayTeam", fields: [awayTeamId], references: [id])
score MatchScore?
markets Market[]
settlements SettlementBatch[]
league League @relation(fields: [leagueId], references: [id])
homeTeam Team @relation("HomeTeam", fields: [homeTeamId], references: [id])
awayTeam Team @relation("AwayTeam", fields: [awayTeamId], references: [id])
score MatchScore?
markets Market[]
settlements SettlementBatch[]
@@index([status])
@@index([startTime])
@@ -339,40 +339,56 @@ model Match {
}
model MatchScore {
id BigInt @id @default(autoincrement())
matchId BigInt @unique @map("match_id")
htHomeScore Int? @map("ht_home_score")
htAwayScore Int? @map("ht_away_score")
ftHomeScore Int? @map("ft_home_score")
ftAwayScore Int? @map("ft_away_score")
winnerTeamId BigInt? @map("winner_team_id")
recordedBy BigInt? @map("recorded_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
matchId BigInt @unique @map("match_id")
htHomeScore Int? @map("ht_home_score")
htAwayScore Int? @map("ht_away_score")
ftHomeScore Int? @map("ft_home_score")
ftAwayScore Int? @map("ft_away_score")
homeCorners Int? @map("home_corners")
awayCorners Int? @map("away_corners")
homeYellowCards Int? @map("home_yellow_cards")
awayYellowCards Int? @map("away_yellow_cards")
homeRedCards Int? @map("home_red_cards")
awayRedCards Int? @map("away_red_cards")
homeCards Int? @map("home_cards")
awayCards Int? @map("away_cards")
winnerTeamId BigInt? @map("winner_team_id")
recordedBy BigInt? @map("recorded_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
match Match @relation(fields: [matchId], references: [id])
match Match @relation(fields: [matchId], references: [id])
@@map("match_scores")
}
model Market {
id BigInt @id @default(autoincrement())
matchId BigInt @map("match_id")
marketType String @map("market_type") @db.VarChar(64)
period String @db.VarChar(16)
lineValue Decimal? @map("line_value") @db.Decimal(8, 2)
status String @default("OPEN") @db.VarChar(20)
allowSingle Boolean @default(true) @map("allow_single")
allowParlay Boolean @default(true) @map("allow_parlay")
sortOrder Int @default(0) @map("sort_order")
promoLabel String? @map("promo_label") @db.VarChar(100)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
matchId BigInt @map("match_id")
marketType String @map("market_type") @db.VarChar(64)
marketKey String? @map("market_key") @db.VarChar(64)
lineKey String? @map("line_key") @db.VarChar(180)
period String @db.VarChar(16)
lineValue Decimal? @map("line_value") @db.Decimal(8, 2)
paramsJson Json? @map("params_json")
status String @default("OPEN") @db.VarChar(20)
allowSingle Boolean @default(true) @map("allow_single")
allowParlay Boolean @default(true) @map("allow_parlay")
showOnPlayer Boolean @default(true) @map("show_on_player")
sortOrder Int @default(0) @map("sort_order")
promoLabel String? @map("promo_label") @db.VarChar(100)
promoLabelI18n Json? @map("promo_label_i18n")
nameI18n Json? @map("name_i18n")
templateItemId BigInt? @map("template_item_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
match Match @relation(fields: [matchId], references: [id])
selections MarketSelection[]
match Match @relation(fields: [matchId], references: [id])
selections MarketSelection[]
@@index([matchId])
@@index([matchId, lineKey])
@@index([marketType])
@@map("markets")
}
@@ -382,6 +398,7 @@ model MarketSelection {
marketId BigInt @map("market_id")
selectionCode String @map("selection_code") @db.VarChar(64)
selectionName String @map("selection_name") @db.VarChar(255)
nameI18n Json? @map("name_i18n")
odds Decimal @db.Decimal(18, 6)
oddsVersion BigInt @default(1) @map("odds_version")
status String @default("OPEN") @db.VarChar(20)
@@ -389,13 +406,80 @@ model MarketSelection {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
market Market @relation(fields: [marketId], references: [id])
oddsLogs OddsChangeLog[]
market Market @relation(fields: [marketId], references: [id])
oddsLogs OddsChangeLog[]
@@index([marketId])
@@map("market_selections")
}
model MarketTemplate {
id BigInt @id @default(autoincrement())
sportType String @default("FOOTBALL") @map("sport_type") @db.VarChar(20)
name String @db.VarChar(128)
nameI18n Json? @map("name_i18n")
description String? @db.VarChar(500)
isDefault Boolean @default(false) @map("is_default")
status String @default("ACTIVE") @db.VarChar(20)
sortOrder Int @default(0) @map("sort_order")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
items MarketTemplateItem[]
@@index([sportType, status])
@@index([isDefault])
@@map("market_templates")
}
model MarketTemplateItem {
id BigInt @id @default(autoincrement())
templateId BigInt @map("template_id")
marketType String @map("market_type") @db.VarChar(64)
marketKey String? @map("market_key") @db.VarChar(64)
lineKey String @map("line_key") @db.VarChar(180)
period String @db.VarChar(16)
lineValue Decimal? @map("line_value") @db.Decimal(8, 2)
paramsJson Json? @map("params_json")
status String @default("OPEN") @db.VarChar(20)
allowSingle Boolean @default(true) @map("allow_single")
allowParlay Boolean @default(true) @map("allow_parlay")
showOnPlayer Boolean @default(true) @map("show_on_player")
sortOrder Int @default(0) @map("sort_order")
promoLabel String? @map("promo_label") @db.VarChar(100)
promoLabelI18n Json? @map("promo_label_i18n")
nameI18n Json? @map("name_i18n")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
template MarketTemplate @relation(fields: [templateId], references: [id], onDelete: Cascade)
selections MarketTemplateSelection[]
@@unique([templateId, lineKey])
@@index([templateId])
@@index([marketType])
@@map("market_template_items")
}
model MarketTemplateSelection {
id BigInt @id @default(autoincrement())
templateItemId BigInt @map("template_item_id")
selectionCode String @map("selection_code") @db.VarChar(64)
selectionName String @map("selection_name") @db.VarChar(255)
nameI18n Json? @map("name_i18n")
odds Decimal @db.Decimal(18, 6)
status String @default("OPEN") @db.VarChar(20)
sortOrder Int @default(0) @map("sort_order")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
item MarketTemplateItem @relation(fields: [templateItemId], references: [id], onDelete: Cascade)
@@unique([templateItemId, selectionCode])
@@index([templateItemId])
@@map("market_template_selections")
}
model OddsChangeLog {
id BigInt @id @default(autoincrement())
selectionId BigInt @map("selection_id")
@@ -405,7 +489,7 @@ model OddsChangeLog {
changedBy BigInt? @map("changed_by")
createdAt DateTime @default(now()) @map("created_at")
selection MarketSelection @relation(fields: [selectionId], references: [id])
selection MarketSelection @relation(fields: [selectionId], references: [id])
@@index([selectionId])
@@map("odds_change_logs")
@@ -433,9 +517,9 @@ model Bet {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id])
selections BetSelection[]
cashbackClaims CashbackBet[]
user User @relation(fields: [userId], references: [id])
selections BetSelection[]
cashbackClaims CashbackBet[]
@@unique([userId, requestId])
@@index([userId])
@@ -453,6 +537,7 @@ model BetSelection {
selectionId BigInt @map("selection_id")
marketType String @map("market_type") @db.VarChar(64)
period String? @db.VarChar(16)
marketNameSnapshot String? @map("market_name_snapshot") @db.VarChar(255)
selectionNameSnapshot String @map("selection_name_snapshot") @db.VarChar(255)
handicapLine Decimal? @map("handicap_line") @db.Decimal(8, 2)
totalLine Decimal? @map("total_line") @db.Decimal(8, 2)
@@ -463,7 +548,7 @@ model BetSelection {
sortOrder Int @default(0) @map("sort_order")
createdAt DateTime @default(now()) @map("created_at")
bet Bet @relation(fields: [betId], references: [id])
bet Bet @relation(fields: [betId], references: [id])
@@index([betId])
@@index([matchId])
@@ -473,41 +558,50 @@ model BetSelection {
// ============ Settlement ============
model SettlementBatch {
id BigInt @id @default(autoincrement())
matchId BigInt @map("match_id")
batchNo String @unique @map("batch_no") @db.VarChar(64)
htHomeScore Int? @map("ht_home_score")
htAwayScore Int? @map("ht_away_score")
ftHomeScore Int? @map("ft_home_score")
ftAwayScore Int? @map("ft_away_score")
status String @default("PREVIEW") @db.VarChar(20)
totalBets Int @default(0) @map("total_bets")
totalPayout Decimal @default(0) @map("total_payout") @db.Decimal(18, 4)
totalRefund Decimal @default(0) @map("total_refund") @db.Decimal(18, 4)
operatorId BigInt? @map("operator_id")
confirmedAt DateTime? @map("confirmed_at")
isResettle Boolean @default(false) @map("is_resettle")
reason String? @db.VarChar(500)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
matchId BigInt @map("match_id")
batchNo String @unique @map("batch_no") @db.VarChar(64)
htHomeScore Int? @map("ht_home_score")
htAwayScore Int? @map("ht_away_score")
ftHomeScore Int? @map("ft_home_score")
ftAwayScore Int? @map("ft_away_score")
homeCorners Int? @map("home_corners")
awayCorners Int? @map("away_corners")
homeYellowCards Int? @map("home_yellow_cards")
awayYellowCards Int? @map("away_yellow_cards")
homeRedCards Int? @map("home_red_cards")
awayRedCards Int? @map("away_red_cards")
homeCards Int? @map("home_cards")
awayCards Int? @map("away_cards")
status String @default("PREVIEW") @db.VarChar(20)
totalBets Int @default(0) @map("total_bets")
totalPayout Decimal @default(0) @map("total_payout") @db.Decimal(18, 4)
totalRefund Decimal @default(0) @map("total_refund") @db.Decimal(18, 4)
operatorId BigInt? @map("operator_id")
confirmedAt DateTime? @map("confirmed_at")
isResettle Boolean @default(false) @map("is_resettle")
reason String? @db.VarChar(500)
createdAt DateTime @default(now()) @map("created_at")
match Match @relation(fields: [matchId], references: [id])
items SettlementItem[]
match Match @relation(fields: [matchId], references: [id])
items SettlementItem[]
@@index([matchId])
@@map("settlement_batches")
}
model SettlementItem {
id BigInt @id @default(autoincrement())
batchId BigInt @map("batch_id")
betId BigInt @map("bet_id")
userId BigInt @map("user_id")
result String @db.VarChar(32)
payout Decimal @db.Decimal(18, 4)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
batchId BigInt @map("batch_id")
betId BigInt @map("bet_id")
userId BigInt @map("user_id")
result String @db.VarChar(32)
payout Decimal @db.Decimal(18, 4)
createdAt DateTime @default(now()) @map("created_at")
batch SettlementBatch @relation(fields: [batchId], references: [id])
batch SettlementBatch @relation(fields: [batchId], references: [id])
@@unique([batchId, betId])
@@index([batchId])
@@index([betId])
@@map("settlement_items")
@@ -516,57 +610,59 @@ model SettlementItem {
// ============ Cashback ============
model CashbackRule {
id BigInt @id @default(autoincrement())
name String @db.VarChar(128)
targetType String @map("target_type") @db.VarChar(32)
targetId BigInt? @map("target_id")
rate Decimal @db.Decimal(8, 4)
marketType String? @map("market_type") @db.VarChar(64)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
name String @db.VarChar(128)
targetType String @map("target_type") @db.VarChar(32)
targetId BigInt? @map("target_id")
rate Decimal @db.Decimal(8, 4)
marketType String? @map("market_type") @db.VarChar(64)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("cashback_rules")
}
model CashbackBatch {
id BigInt @id @default(autoincrement())
batchNo String @unique @map("batch_no") @db.VarChar(64)
periodStart DateTime @map("period_start")
periodEnd DateTime @map("period_end")
status String @default("PREVIEW") @db.VarChar(20)
totalAmount Decimal @default(0) @map("total_amount") @db.Decimal(18, 4)
totalEffectiveStake Decimal @default(0) @map("total_effective_stake") @db.Decimal(18, 4)
totalBetCount Int @default(0) @map("total_bet_count")
playerCount Int @default(0) @map("player_count")
operatorId BigInt? @map("operator_id")
id BigInt @id @default(autoincrement())
batchNo String @unique @map("batch_no") @db.VarChar(64)
periodStart DateTime @map("period_start")
periodEnd DateTime @map("period_end")
status String @default("PREVIEW") @db.VarChar(20)
totalAmount Decimal @default(0) @map("total_amount") @db.Decimal(18, 4)
totalEffectiveStake Decimal @default(0) @map("total_effective_stake") @db.Decimal(18, 4)
totalBetCount Int @default(0) @map("total_bet_count")
playerCount Int @default(0) @map("player_count")
operatorId BigInt? @map("operator_id")
confirmedAt DateTime? @map("confirmed_at")
createdAt DateTime @default(now()) @map("created_at")
createdAt DateTime @default(now()) @map("created_at")
items CashbackItem[]
bets CashbackBet[]
items CashbackItem[]
bets CashbackBet[]
@@map("cashback_batches")
}
model CashbackItem {
id BigInt @id @default(autoincrement())
batchId BigInt @map("batch_id")
userId BigInt @map("user_id")
effectiveStake Decimal @map("effective_stake") @db.Decimal(18, 4)
betCount Int @default(0) @map("bet_count")
rate Decimal @db.Decimal(8, 4)
amount Decimal @db.Decimal(18, 4)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
batchId BigInt @map("batch_id")
userId BigInt @map("user_id")
effectiveStake Decimal @map("effective_stake") @db.Decimal(18, 4)
betCount Int @default(0) @map("bet_count")
rate Decimal @db.Decimal(8, 4)
amount Decimal @db.Decimal(18, 4)
createdAt DateTime @default(now()) @map("created_at")
batch CashbackBatch @relation(fields: [batchId], references: [id])
batch CashbackBatch @relation(fields: [batchId], references: [id])
@@index([batchId])
@@index([userId])
@@map("cashback_items")
}
/** 返水批次占用的注单(每笔注单全局仅能计入一次待发放/已发放批次) */
/**
* 返水批次占用的注单(每笔注单全局仅能计入一次待发放/已发放批次)
*/
model CashbackBet {
id BigInt @id @default(autoincrement())
batchId BigInt @map("batch_id")
@@ -576,8 +672,8 @@ model CashbackBet {
amount Decimal @db.Decimal(18, 4)
createdAt DateTime @default(now()) @map("created_at")
batch CashbackBatch @relation(fields: [batchId], references: [id], onDelete: Cascade)
bet Bet @relation(fields: [betId], references: [id])
batch CashbackBatch @relation(fields: [batchId], references: [id], onDelete: Cascade)
bet Bet @relation(fields: [betId], references: [id])
@@index([batchId])
@@index([userId])
@@ -612,7 +708,7 @@ model ContentTranslation {
body String? @db.Text
imageUrl String? @map("image_url") @db.VarChar(500)
content Content @relation(fields: [contentId], references: [id])
content Content @relation(fields: [contentId], references: [id])
@@unique([contentId, locale])
@@map("content_translations")
@@ -649,20 +745,20 @@ model UploadedFile {
// ============ Manual Deposit / Recharge ============
model PaymentMethod {
id BigInt @id @default(autoincrement())
methodType String @map("method_type") @db.VarChar(20)
bankName String? @map("bank_name") @db.VarChar(128)
accountHolder String? @map("account_holder") @db.VarChar(128)
accountNumber String? @map("account_number") @db.VarChar(128)
usdtAddress String? @map("usdt_address") @db.VarChar(256)
qrCodeUrl String? @map("qr_code_url") @db.VarChar(500)
displayName String? @map("display_name") @db.VarChar(128)
sortOrder Int @default(0) @map("sort_order")
isActive Boolean @default(true) @map("is_active")
showOnPlayer Boolean @default(true) @map("show_on_player")
createdBy BigInt? @map("created_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
methodType String @map("method_type") @db.VarChar(20)
bankName String? @map("bank_name") @db.VarChar(128)
accountHolder String? @map("account_holder") @db.VarChar(128)
accountNumber String? @map("account_number") @db.VarChar(128)
usdtAddress String? @map("usdt_address") @db.VarChar(256)
qrCodeUrl String? @map("qr_code_url") @db.VarChar(500)
displayName String? @map("display_name") @db.VarChar(128)
sortOrder Int @default(0) @map("sort_order")
isActive Boolean @default(true) @map("is_active")
showOnPlayer Boolean @default(true) @map("show_on_player")
createdBy BigInt? @map("created_by")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
depositOrders DepositOrder[]
@@ -699,28 +795,28 @@ model DepositOrder {
// ============ System Config & Audit ============
model SystemConfig {
id BigInt @id @default(autoincrement())
configKey String @unique @map("config_key") @db.VarChar(128)
configValue String @map("config_value") @db.Text
description String? @db.VarChar(255)
updatedAt DateTime @updatedAt @map("updated_at")
id BigInt @id @default(autoincrement())
configKey String @unique @map("config_key") @db.VarChar(128)
configValue String @map("config_value") @db.Text
description String? @db.VarChar(255)
updatedAt DateTime @updatedAt @map("updated_at")
@@map("system_configs")
}
model AuditLog {
id BigInt @id @default(autoincrement())
operatorId BigInt? @map("operator_id")
operatorType String @map("operator_type") @db.VarChar(20)
action String @db.VarChar(128)
module String @db.VarChar(64)
targetType String? @map("target_type") @db.VarChar(32)
targetId String? @map("target_id") @db.VarChar(64)
beforeData String? @map("before_data") @db.Text
afterData String? @map("after_data") @db.Text
ipAddress String? @map("ip_address") @db.VarChar(45)
userAgent String? @map("user_agent") @db.VarChar(500)
createdAt DateTime @default(now()) @map("created_at")
id BigInt @id @default(autoincrement())
operatorId BigInt? @map("operator_id")
operatorType String @map("operator_type") @db.VarChar(20)
action String @db.VarChar(128)
module String @db.VarChar(64)
targetType String? @map("target_type") @db.VarChar(32)
targetId String? @map("target_id") @db.VarChar(64)
beforeData String? @map("before_data") @db.Text
afterData String? @map("after_data") @db.Text
ipAddress String? @map("ip_address") @db.VarChar(45)
userAgent String? @map("user_agent") @db.VarChar(500)
createdAt DateTime @default(now()) @map("created_at")
@@index([operatorId])
@@index([module])