新功能: 1. S3存储桶配置管理 - 可在系统设置中配置S3端点、密钥等 2. 全站实时弹幕功能 - 右下角悬浮球,支持实时发送和接收弹幕 3. LOGO分离上传 - 导航栏LOGO和登录页LOGO分开上传 数据库更新: - SystemSettings表新增s3Endpoint, s3AccessKey, s3SecretKey等6个字段 - 新增Danmaku表用于存储弹幕数据 技术改进: - 部门管理从系统设置移至系统管理标签页 - 优化了浏览器标题动态更新 - 添加了弹幕轮询机制(2秒)
139 lines
4.1 KiB
Plaintext
139 lines
4.1 KiB
Plaintext
// This is your Prisma schema file,
|
||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||
|
||
generator client {
|
||
provider = "prisma-client-js"
|
||
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
||
}
|
||
|
||
datasource db {
|
||
provider = "postgresql"
|
||
url = env("DATABASE_URL")
|
||
}
|
||
|
||
model User {
|
||
id String @id @default(uuid())
|
||
email String @unique
|
||
username String @unique
|
||
password String
|
||
department String @default("") // 用户部门
|
||
role Role @default(USER)
|
||
isActive Boolean @default(false) // 是否激活,默认未激活
|
||
canDownload Boolean @default(true) // 是否允许下载,默认允许
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
materials Material[]
|
||
likes MaterialLike[]
|
||
|
||
@@map("users")
|
||
}
|
||
|
||
model Material {
|
||
id String @id @default(uuid())
|
||
previewUrl String // S3 URL for preview image
|
||
productModel String // SPU
|
||
categoryName String // 使用店铺
|
||
sceneName String // 场景类别
|
||
materialType String @default("3DMAX") // 素材类型:3DMAX/PSD/AI/CAD/C4D/其他
|
||
renderer String @default("CR") // 渲染器:CR/VR/其它(仅3DMAX使用)
|
||
authorName String // 作者花名
|
||
zipFileName String // 压缩包文件名
|
||
zipFilePath String // 本地压缩包路径
|
||
zipFileSize BigInt @default(0) // 压缩包文件大小(字节)
|
||
downloadCount Int @default(0) // 下载次数
|
||
likeCount Int @default(0) // 点赞次数
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
userId String
|
||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||
likes MaterialLike[]
|
||
|
||
@@map("materials")
|
||
@@index([userId])
|
||
@@index([createdAt])
|
||
@@index([categoryName])
|
||
@@index([sceneName])
|
||
@@index([materialType])
|
||
@@index([downloadCount])
|
||
@@index([likeCount])
|
||
}
|
||
|
||
model MaterialLike {
|
||
id String @id @default(uuid())
|
||
materialId String
|
||
userId String
|
||
createdAt DateTime @default(now())
|
||
|
||
material Material @relation(fields: [materialId], references: [id], onDelete: Cascade)
|
||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||
|
||
@@unique([materialId, userId]) // 确保一个用户只能点赞一次
|
||
@@map("material_likes")
|
||
@@index([materialId])
|
||
@@index([userId])
|
||
}
|
||
|
||
model Category {
|
||
id String @id @default(uuid())
|
||
name String @unique // 使用店铺名称
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("categories")
|
||
}
|
||
|
||
model Scene {
|
||
id String @id @default(uuid())
|
||
name String @unique // 场景类别名称
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("scenes")
|
||
}
|
||
|
||
model SystemSettings {
|
||
id String @id @default(uuid())
|
||
headerBgColor String @default("#1f2937") // 顶部导航栏背景色
|
||
headerLogoUrl String @default("http://s3.1080p.hk/shuzhou/2025/05/18/8ebadf0a7cc34eaea00e8619b8efb827.png") // 导航栏LOGO URL(深色背景用)
|
||
loginLogoUrl String @default("http://s3.1080p.hk/shuzhou/2025/05/18/8ebadf0a7cc34eaea00e8619b8efb827.png") // 登录页面LOGO URL(浅色背景用)
|
||
siteName String @default("由壹点3D素材") // 网站名称
|
||
|
||
// S3存储桶配置
|
||
s3Endpoint String @default("") // S3端点
|
||
s3AccessKey String @default("") // S3访问密钥
|
||
s3SecretKey String @default("") // S3密钥
|
||
s3Bucket String @default("") // 存储桶名称
|
||
s3Region String @default("us-east-1") // 区域
|
||
s3PublicUrl String @default("") // 公网访问URL
|
||
|
||
updatedAt DateTime @updatedAt
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("system_settings")
|
||
}
|
||
|
||
model Department {
|
||
id String @id @default(uuid())
|
||
name String @unique // 部门名称
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("departments")
|
||
}
|
||
|
||
model Danmaku {
|
||
id String @id @default(uuid())
|
||
content String // 弹幕内容
|
||
username String // 发送者用户名
|
||
userId String // 发送者ID
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("danmakus")
|
||
@@index([createdAt])
|
||
}
|
||
|
||
enum Role {
|
||
USER
|
||
ADMIN
|
||
}
|
||
|