- 新增许可证服务器 (license-server/) - 新增 Agent 部署模块 (flnxi-agent/) - 添加许可证验证和激活页面 - 添加 Harbor 镜像同步脚本 - 更新素材系统支持许可证验证
149 lines
4.2 KiB
Plaintext
149 lines
4.2 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "linux-musl", "debian-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
// 客户表
|
|
model Customer {
|
|
id String @id @default(uuid())
|
|
companyName String @map("company_name")
|
|
contactName String? @map("contact_name")
|
|
contactEmail String? @map("contact_email")
|
|
contactPhone String? @map("contact_phone")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
licenses License[]
|
|
|
|
@@map("customers")
|
|
}
|
|
|
|
// 许可证类型枚举
|
|
enum LicenseType {
|
|
FREE
|
|
STANDARD
|
|
PRO
|
|
}
|
|
|
|
// 许可证状态枚举
|
|
enum LicenseStatus {
|
|
active
|
|
disabled
|
|
expired
|
|
}
|
|
|
|
// 许可证表
|
|
model License {
|
|
id String @id @default(uuid())
|
|
customerId String? @map("customer_id")
|
|
licenseKey String @unique @map("license_key")
|
|
licenseType LicenseType @map("license_type")
|
|
status LicenseStatus @default(active)
|
|
maxUsers Int @default(-1) @map("max_users")
|
|
maxMaterials Int @default(-1) @map("max_materials")
|
|
features Json @default("{}")
|
|
expiresAt DateTime? @map("expires_at")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
customer Customer? @relation(fields: [customerId], references: [id])
|
|
activations Activation[]
|
|
heartbeatLogs HeartbeatLog[]
|
|
alerts Alert[]
|
|
|
|
@@map("licenses")
|
|
}
|
|
|
|
// 激活记录表
|
|
model Activation {
|
|
id String @id @default(uuid())
|
|
licenseId String @map("license_id")
|
|
instanceId String @map("instance_id")
|
|
fingerprint Json
|
|
activatedAt DateTime @default(now()) @map("activated_at")
|
|
lastHeartbeat DateTime? @map("last_heartbeat")
|
|
usageStats Json @default("{}") @map("usage_stats")
|
|
isActive Boolean @default(true) @map("is_active")
|
|
|
|
license License @relation(fields: [licenseId], references: [id])
|
|
|
|
@@map("activations")
|
|
}
|
|
|
|
// 心跳记录表
|
|
model HeartbeatLog {
|
|
id String @id @default(uuid())
|
|
licenseId String @map("license_id")
|
|
instanceId String @map("instance_id")
|
|
fingerprintHash String @map("fingerprint_hash")
|
|
ipAddress String? @map("ip_address")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
license License @relation(fields: [licenseId], references: [id])
|
|
|
|
@@map("heartbeat_logs")
|
|
}
|
|
|
|
// 告警类型枚举
|
|
enum AlertStatus {
|
|
pending
|
|
resolved
|
|
ignored
|
|
}
|
|
|
|
// 告警表
|
|
model Alert {
|
|
id String @id @default(uuid())
|
|
licenseId String @map("license_id")
|
|
alertType String @map("alert_type")
|
|
details Json?
|
|
status AlertStatus @default(pending)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
resolvedAt DateTime? @map("resolved_at")
|
|
|
|
license License @relation(fields: [licenseId], references: [id])
|
|
|
|
@@map("alerts")
|
|
}
|
|
|
|
// 管理员表
|
|
model Admin {
|
|
id String @id @default(uuid())
|
|
username String @unique
|
|
passwordHash String @map("password_hash")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
@@map("admins")
|
|
}
|
|
|
|
// 版本信息表(素材系统)
|
|
model Version {
|
|
id String @id @default(uuid())
|
|
version String @unique
|
|
releaseNotes String? @map("release_notes")
|
|
minRequiredVersion String? @map("min_required_version")
|
|
isSecurityUpdate Boolean @default(false) @map("is_security_update")
|
|
isCriticalUpdate Boolean @default(false) @map("is_critical_update")
|
|
downloadSize String? @map("download_size")
|
|
releaseDate DateTime @default(now()) @map("release_date")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@map("versions")
|
|
}
|
|
|
|
// Agent 版本信息表
|
|
model AgentVersion {
|
|
id String @id @default(uuid())
|
|
version String @unique
|
|
releaseNotes String? @map("release_notes")
|
|
releaseDate DateTime @default(now()) @map("release_date")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@map("agent_versions")
|
|
}
|