v0.11.1: 权限体系重构 + AI管线优化 + 内容整理

This commit is contained in:
sgp
2026-05-22 18:36:41 +08:00
parent 7955d11c52
commit b33fe1e8e1
397 changed files with 30940 additions and 161 deletions
+136
View File
@@ -0,0 +1,136 @@
# 数据库模块
## 技术栈
- Prisma 7.8 + @prisma/adapter-mariadb
- MySQL (阿里云RDS)
- 连接字符串: `mysql://mohe001:***@rm-0jlbgr2rv6dj3t6jngo.mysql.rds.aliyuncs.com:3306/zhuiguang_ai`
## 数据模型
### Category (工具分类)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id @default(autoincrement()) | 主键 |
| name | String @db.VarChar(100) | 分类名称 |
| slug | String @unique @db.VarChar(100) | URL标识 |
| icon | String? | 图标 |
| parentId | Int? | 父分类ID(自引用) |
| sortOrder | Int @default(0) | 排序权重 |
| createdAt | DateTime | 创建时间 |
| updatedAt | DateTime | 更新时间 |
### SkillCategory (技能分类)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id @default(autoincrement()) | 主键 |
| name | String @db.VarChar(100) | 分类名称 |
| slug | String @unique @db.VarChar(100) | URL标识 |
| icon | String? | 图标 |
| parentId | Int? | 父分类ID(自引用) |
| sortOrder | Int @default(0) | 排序权重 |
| createdAt | DateTime | 创建时间 |
| updatedAt | DateTime | 更新时间 |
### Tool (已发布工具)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id | 主键 |
| name | String | 工具名称 |
| slug | String @unique | URL标识 |
| categoryId | Int | 分类ID(必填) |
| description | String @db.Text | 简介 |
| logoUrl | String? | Logo地址 |
| websiteUrl | String | 官网地址 |
| pricingModel | PricingModel | 定价模型(free/freemium/paid/subscription) |
| pricingDetail | String? | 定价详情 |
| features | Json? | 功能特性数组 |
| tags | Json? | 标签数组 |
| viewCount | Int @default(0) | 浏览次数 |
| status | Status @default(draft) | 状态(draft/published) |
| createdAt/updatedAt | DateTime | 时间戳 |
### PendingTool (待审核工具)
与Tool类似,但categoryId/description/websiteUrl等可为空,额外有sourceUrl和status(pending/approved/rejected)。
### Skill (已发布技能)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id | 主键 |
| name | String | 技能名称 |
| slug | String @unique | URL标识 |
| categoryId | Int | 分类ID(必填) |
| description | String @db.Text | 简介 |
| logoUrl | String? | Logo地址 |
| sourceUrl | String | GitHub仓库地址 |
| sourceType | String @default("gitee") | 来源类型 |
| rating | Float @default(0) | 综合评分 |
| features | Json? | 功能特性(含forks/language/license/topics) |
| tags | Json? | 标签数组 |
| viewCount | Int @default(0) | 浏览次数 |
| status | Status | 状态 |
| lastReviewedAt | DateTime? | 最近评测时间 |
| githubStarsHistory | Json? | Star历史数据 |
### PendingSkill (待审核技能)
与Skill类似,但多个字段可为空。
### SystemConfig (系统配置)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id | 主键 |
| key | String @unique | 配置键 |
| value | Json | 配置值(JSON) |
### SkillReview (技能评测)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id @default(autoincrement()) | 主键 |
| skillId | Int @unique | 关联Skill(一对一) |
| capability | Float | 场景与能力评分(1-5) |
| devExp | Float | 开发体验评分(1-5) |
| costLicense | Float | 成本与许可评分(1-5) |
| community | Float | 社区健康评分(1-5) |
| performance | Float | 性能稳定评分(1-5) |
| overall | Float | 综合评分(五维均值) |
| reviews | Json | 完整评测数据(含各维度summary/detail) |
| longArticle | String? @db.Text | 长文评测 |
| videoScript | String? @db.Text | 视频脚本 |
| socialCards | Json? | 社交卡片数据 |
| status | ReviewStatus @default(DRAFT) | 评测状态 |
| reviewedAt | DateTime @updatedAt | 评测时间 |
| createdAt | DateTime | 创建时间 |
### ReviewGenerationLog (评测生成日志)
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Int @id @default(autoincrement()) | 主键 |
| skillId | Int | 关联Skill ID |
| status | String @db.VarChar(20) | SUCCESS/FAILED |
| prompt | String @db.Text | 生成提示词 |
| response | String? @db.Text | API响应内容 |
| error | String? @db.Text | 错误信息 |
| createdAt | DateTime | 创建时间 |
## 枚举
- `PricingModel`: free, freemium, paid, subscription
- `Status`: draft, published
- `PendingStatus`: pending, approved, rejected
- `ReviewStatus`: DRAFT, PUBLISHED, REJECTED, OUTDATED
## 索引
- Tool: categoryId+status联合索引, name+description全文索引
- Skill: categoryId+status联合索引
- SkillReview: skillId索引(唯一), overall索引
- ReviewGenerationLog: skillId索引
## 迁移历史
1. init - 初始化
2. remove_scraped_at - 移除scrapedAt字段
3. add_discovery_configs - 添加发现配置
4. fix_tag_pool_column - 修复标签池列
5. add_discovery_configs_v2 - 发现配置V2
6. add_api_providers_and_skills - 添加API提供者和技能
7. add_skill_categories - 添加技能分类
8. add_pendingtool_category_relation - 添加待审核工具分类关联
9. add_hot_score - 添加热度评分
10. add_skill_reviews - 添加技能评测表(SkillReview/ReviewGenerationLog)、Skill新增lastReviewedAt/githubStarsHistory字段