Add TKMind platform extensions, H5/MindSpace stack, and deployment tooling.
Deploy Documentation / deploy (push) Has been cancelled
Canary / Prepare Version (push) Has been cancelled
Canary / build-cli (push) Has been cancelled
Canary / Upload Install Script (push) Has been cancelled
Canary / bundle-desktop (push) Has been cancelled
Canary / bundle-desktop-intel (push) Has been cancelled
Canary / bundle-desktop-linux (push) Has been cancelled
Canary / bundle-desktop-windows (push) Has been cancelled
Canary / bundle-desktop-windows-cuda (push) Has been cancelled
Canary / Release (push) Has been cancelled
Unused Dependencies / machete (push) Has been cancelled
CI / changes (push) Has been cancelled
CI / Check Rust Code Format (push) Has been cancelled
CI / Build and Test Rust Project (push) Has been cancelled
CI / Build Rust Project on Windows (push) Has been cancelled
CI / Check MSRV (push) Has been cancelled
CI / Lint Rust Code (push) Has been cancelled
CI / Check Generated Schemas are Up-to-Date (push) Has been cancelled
CI / Test and Lint Electron Desktop App (push) Has been cancelled
CI / H5 Plaza Tests and Build (push) Has been cancelled
Live Provider Tests / check-fork (push) Has been cancelled
Live Provider Tests / changes (push) Has been cancelled
Live Provider Tests / Build Binary (push) Has been cancelled
Live Provider Tests / Smoke Tests (push) Has been cancelled
Live Provider Tests / Smoke Tests (Code Execution) (push) Has been cancelled
Live Provider Tests / Compaction Tests (push) Has been cancelled
Live Provider Tests / goose server HTTP integration tests (push) Has been cancelled
Publish Ask AI Bot Docker Image / docker (push) Has been cancelled
Publish Docker Image / docker (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled

Fork goose with custom MCP widgets, platform extensions (aider, git, web, search),
MindSpace H5 backend/frontend, Plaza/Ops UIs, and deploy scripts for tkmind.cn.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-14 21:30:20 +08:00
parent e5fd568e01
commit 4e21ca937a
359 changed files with 70658 additions and 56 deletions
@@ -0,0 +1,241 @@
---
sidebar_position: 7
title: 运营后台
sidebar_label: 运营后台
description: 运营后台功能规范、权限设计、内容审核流程、精选管理和数据看板
---
# 运营后台
## 定位
运营后台(`ui/ops/`)是广场内容治理的专用工具,面向运营人员,不面向普通用户。
与现有管理后台(`/admin`)的分工:
| 功能 | 现有 /admin | 运营后台 /ops |
| --- | --- | --- |
| 用户管理(冻结、套餐) | ✅ | ❌ |
| LLM 密钥和系统配置 | ✅ | ❌ |
| 广场内容审核 | ❌ | ✅ |
| 精选和推广管理 | ❌ | ✅ |
| 广场数据看板 | ❌ | ✅ |
| 违规帖子处理 | ❌ | ✅ |
| 创作者认证 | ❌ | ✅ |
**关键原则**:运营人员看不到 LLM 密钥、系统配置和付费记录,系统管理员看不到广场审核队列。
---
## 访问控制
运营后台通过 Nginx 限制只允许内网 IP 访问:
```nginx
location /ops {
allow 10.0.0.0/8;
deny all;
proxy_pass http://127.0.0.1:3002;
}
```
后端 API `/api/ops/v1/*` 通过独立中间件验证 `ops_role`
```text
ops_role = reviewer 内容审核人员,可审核帖子和评论
ops_role = editor 编辑,可设置精选和标签
ops_role = ops_admin 运营管理员,所有运营权限 + 查看数据看板
```
`users` 表新增 `ops_role ENUM('none', 'reviewer', 'editor', 'ops_admin') DEFAULT 'none'`,由系统管理员分配。
---
## 功能模块
### 1. 审核队列
**入口**`/ops/review`
**页面布局**
```text
┌────────────────────────────────────────────────────────┐
│ 审核队列 [待审核 234] [已审核 1,892] [已拒绝 45] │
├────────────────────────────────────────────────────────┤
│ 筛选:分类 ▼ 时间范围 ▼ 关键词搜索 │
├────────────────────────────────────────────────────────┤
│ ┌──────────────────────────────────────────────────┐ │
│ │ [封面缩略图] 标题 │ │
│ │ 作者 @slug 发布时间 分类 │ │
│ │ 摘要预览 │ │
│ │ [通过] [拒绝] [预览] │ │
│ └──────────────────────────────────────────────────┘ │
│ ... 更多帖子 ... │
└────────────────────────────────────────────────────────┘
```
**操作流程**
```text
审核人员点击 [通过]
→ plaza_posts.status = published
→ 写入 ops_audit_log(操作人、时间、原状态、新状态)
→ 刷新队列
审核人员点击 [拒绝]
→ 弹出原因选择:违规内容 / 低质内容 / 重复内容 / 广告推广 / 其他(自填)
→ plaza_posts.status = rejected
→ 发送站内通知给创作者(内容:拒绝原因)
→ 写入 ops_audit_log
审核人员点击 [预览]
→ 新标签页打开 /plaza/p/{id}(不改变状态,仅预览)
```
**批量操作**:选中多条 → 批量通过(仅通过,拒绝需要逐条填写原因)。
**SLA 要求**:审核队列中 `pending_review` 超过 2 小时的帖子,展示橙色警告标记。
---
### 2. 举报处理
**入口**`/ops/reports`
用户可以对帖子和评论发起举报。后端新增 `plaza_reports` 表:
```sql
CREATE TABLE plaza_reports (
id CHAR(36) NOT NULL,
target_type ENUM('post', 'comment') NOT NULL,
target_id CHAR(36) NOT NULL,
reporter_id CHAR(36) NOT NULL, -- → users.id
reason ENUM(
'spam',
'violence',
'porn',
'political',
'privacy',
'other'
) NOT NULL,
detail VARCHAR(500) NOT NULL DEFAULT '',
status ENUM('pending', 'processed', 'dismissed') NOT NULL DEFAULT 'pending',
processed_by CHAR(36) NULL, -- → users.id(运营)
processed_at DATETIME NULL,
action_taken VARCHAR(200) NOT NULL DEFAULT '',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY idx_status_type (status, target_type, created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
举报队列展示:同一帖子的举报数量 > 3 时,红色标记。运营可以直接从举报队列跳转隐藏帖子。
---
### 3. 精选管理
**入口**`/ops/featured`
运营可以将优质帖子设置为精选,精选内容在广场首页置顶展示。
**精选位类型**
| 类型 | 说明 | 最大数量 |
| --- | --- | --- |
| `homepage_banner` | 首页顶部轮播(大图) | 5 条 |
| `category_top` | 分类页置顶 | 每个分类 3 条 |
| `trending` | 热门趋势区 | 10 条 |
**精选配置表**
```sql
CREATE TABLE plaza_featured (
id CHAR(36) NOT NULL,
post_id CHAR(36) NOT NULL, -- → plaza_posts.id
position VARCHAR(50) NOT NULL,
sort_order INT NOT NULL DEFAULT 0,
starts_at DATETIME NOT NULL,
expires_at DATETIME NULL, -- NULL 表示永不过期
created_by CHAR(36) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY idx_position_active (position, starts_at, expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
过期的精选自动从展示列表移除(查询时加 `expires_at > NOW() OR expires_at IS NULL` 条件)。
---
### 4. 创作者管理
**入口**`/ops/creators`
运营可以:
- 搜索创作者(按用户名、帖子数、粉丝数排序)。
- 为创作者添加认证标记(`verified_badge`)。
- 限制创作者发帖权限(`post_banned`)或评论权限(`comment_banned`)。
- 查看创作者的所有帖子。
`users` 表新增字段见 [02-data-model](./02-data-model)`ops_role``plaza_verified` 等在同一迁移中定义)。
---
### 5. 数据看板
**入口**`/ops/analytics`(仅 `ops_admin` 可访问)
**概览指标(今日 vs 昨日)**
```text
新帖数 发布转化率 日活用户 新注册来自广场
↑12% 32.4% ↑8% ↑23%
```
**图表**
- 近 14 天每日新帖数折线图
- 分类帖子分布饼图
- TOP 10 创作者(按帖子数 / 点赞数 / 粉丝增长)
- 违规比率趋势折线图
- 广场带来的 MindSpace 新注册数(通过 UTM 参数追踪)
**数据来源**:后端 `/api/ops/v1/analytics/*` 接口,数据每小时预聚合写入统计表,不实时查询明细表。
---
## 运营日志
所有运营操作写入 `ops_audit_log` 表:
```sql
CREATE TABLE ops_audit_log (
id CHAR(36) NOT NULL,
operator_id CHAR(36) NOT NULL, -- → users.id(运营人员)
action VARCHAR(100) NOT NULL, -- approve_post, reject_post, hide_post, set_featured...
target_type VARCHAR(50) NOT NULL,
target_id CHAR(36) NOT NULL,
detail JSON NOT NULL, -- 操作前后的状态快照
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY idx_operator (operator_id, created_at DESC),
KEY idx_target (target_type, target_id, created_at DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
日志只追加,不允许修改或删除,保留 180 天。
---
## 运营后台启动顺序
初期可以使用现有 `/admin` 后台临时管理内容审核(扩展一个"广场管理"菜单),等广场日活超过 1000 后,再独立启动 `ui/ops/` 项目:
```bash
# Sprint 1:在 /admin 下新增简单的帖子审核入口(最小可用)
# Sprint 3:独立 ui/ops/ 项目上线完整审核队列
# Sprint 5:精选管理和数据看板
```