Update nexus: fix conflicts and sync local changes

This commit is contained in:
Shen Wei
2026-04-26 12:06:50 +08:00
parent 191797c01b
commit f09834b5a5
2443 changed files with 254323 additions and 255154 deletions

View File

@@ -1,280 +1,280 @@
# Fonrey 房睿 — MVP 范围书
**Status**: Draft
**Author**: Product Team
**Last Updated**: 2026-04-24
**Version**: 1.0
> **For AI assistants**: 本文件定义 Phase 1MVP的边界。在任何功能实现前先对照本文确认是否在范围内。范围外的功能禁止在 MVP 阶段实现。
---
## 1. 产品背景与目标
**Fonrey房睿** 是一套面向中小型房产经纪公司的 B2B SaaS 管理平台,解决以下核心痛点:
- 房源/客源信息散乱,全靠人工记录
- 跟进记录缺失,数据流失严重
- 重复录入浪费大量经纪人时间
- 无法支撑 89,000+ 数据量级下的高效房客匹配
**MVP 目标**:在一家种子客户(单租户)环境下,完整跑通"录入房源 → 录入客源 → 匹配带看 → 成交"的核心业务链路。
---
## 2. MVP 核心功能清单Phase 1 必须实现)
### 2.1 优先级定义
| 优先级 | 含义 |
|--------|------|
| **P0** | MVP 上线前必须完成,阻断核心业务链路 |
| **P1** | MVP 上线后第一个迭代周期内完成 |
| **P2** | 已规划,列入路线图但不阻断上线 |
---
### 2.2 模块优先级矩阵
#### 🏠 房源管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 录入住宅(二手出售/出租) | **P0** | 核心业务入口 |
| 房源列表(二手&租赁) | **P0** | 含筛选、排序、分页 |
| 房源详情页 | **P0** | 含基本信息、产证、交易信息展示 |
| 跟进记录(全部/写入/修改/其他) | **P0** | 含钥匙、委托、实勘 |
| 图片管理(相册上传/分类/排序) | **P0** | 核心房源内容 |
| 业主联系人管理 | **P0** | 含新增/编辑/查看同业主房源 |
| 价格调整(调价/调价记录) | **P0** | 核心运营操作 |
| 房源状态变更(在售/暂缓/成交/下架) | **P0** | 状态机核心 |
| 房源维护完成度(诊断面板) | **P1** | 提升数据质量 |
| 敏感信息跟进(查看权限控制) | **P1** | 需配合权限模块 |
| 附件管理 | **P1** | 非阻断性 |
| 市场报盘 | **P1** | 运营辅助功能 |
| 价格解读 | **P1** | 分析辅助 |
| 录入别墅/商铺/商住/写字楼/其他 | **P2** | 住宅优先,商业类低频 |
| 全部商铺列表 / 全部写字楼列表 | **P2** | 配合 P2 录入功能 |
| 房源广场 | **P2** | 跨租户/公共池功能 |
#### 🏙️ 楼盘管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 楼盘列表 + 楼盘详情(楼盘信息/楼栋/结构) | **P0** | 房源数据底座,必须先行 |
| 区域管理(城区/商圈) | **P0** | 房源关联必须 |
| 楼盘照片管理 | **P1** | 数据完善 |
| 楼盘价格走势 | **P1** | 分析辅助 |
| 周边配套(学校管理) | **P1** | 补充信息 |
| 应用数据标准 | **P2** | 明确不做 |
#### 👥 客源管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 录入私客(求购/求租) | **P0** | 核心业务 |
| 私客列表(全部/求购/求租) | **P0** | 含筛选、排序 |
| 私客详情(基本信息/需求信息) | **P0** | |
| 跟进记录(全部/写入/修改/其他) | **P0** | |
| 带看管理(预约带看/新增带看) | **P0** | 房客匹配核心 |
| 联系人管理 | **P0** | |
| 客源状态变更(改等级/改状态) | **P0** | |
| 转公客 / 转成交 / 转无效 | **P0** | 生命周期核心 |
| 二手配房(智能匹配) | **P1** | 核心价值,但可后续迭代 |
| 客源解读 | **P1** | AI 辅助分析 |
| 客源信息概览 | **P1** | 汇总视图 |
| 客源收藏夹 | **P1** | 辅助功能 |
| 公客管理 | **P2** | 私客优先 |
| 成交客管理 | **P2** | |
| 暂缓私客 | **P2** | |
#### 🏢 组织人事
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 公司组织结构(部门/门店树) | **P0** | 权限系统基础 |
| 员工列表/员工详情 | **P0** | |
| 员工入职/账号创建 | **P0** | |
| 员工离职 / 调动 | **P1** | |
| 员工通讯录 | **P1** | |
| 异动记录 | **P1** | |
| 奖惩记录 | **P2** | |
| 职务管理 | **P1** | |
| 门店分布地图 | **P2** | |
#### 🔐 权限管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 角色管理(预设角色 + 自定义角色) | **P0** | 权限基础 |
| 人员权限列表 | **P0** | |
| 角色批量分配 | **P0** | |
| 功能权限(菜单级) | **P0** | |
| 数据权限(部门/个人/全司) | **P0** | |
| 字段级权限(敏感字段可见性) | **P1** | 配合房源/客源敏感信息 |
| 个人特定权限覆盖 | **P1** | |
#### 🔑 用户登录
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 账号密码登录 | **P0** | |
| 多租户识别(子域名/域名) | **P0** | |
| Token 管理 / 会话超时 | **P0** | |
| 短信验证码登录 | **P1** | |
| 密码重置 | **P1** | |
| 记住登录状态 | **P1** | |
#### ⚙️ 系统配置
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 首页设置 | **P1** | |
| 房源设置(字段必填/自定义字段/标签) | **P0** | 影响录入表单 |
| 相关方设置 | **P1** | |
| 客源设置(基本配置/参数配置) | **P1** | |
| 人事OA设置 | **P2** | |
| 交易设置 | **P2** | |
| 财务设置 | **P2** | |
| 合同设置 | **P2** | |
#### 🖥️ 系统管理(运营后台)
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 租户管理(开通/暂停/配置) | **P1** | 单租户种子阶段可手动 |
| 系统健康监控 | **P1** | |
| 操作审计日志 | **P2** | |
| 灰度发布 / 滚动升级 | **P2** | |
#### 💻 客户端发布
| 功能 | 优先级 | 说明 |
|------|--------|------|
| Windows 桌面客户端(内置浏览器) | **P1** | 种子客户使用 Web 端可先行 |
| 自动更新机制 | **P1** | 配合客户端 |
---
## 3. 非目标Out of Scope — MVP 阶段绝对不做)
以下功能在 MVP 阶段**明确不实现**AI 生成代码时不得为这些功能预留接口或引入相关依赖:
| 功能 | 原因 |
|------|------|
| 移动端适配 | v2 规划 |
| 新房模块(新房管理/新房设置) | 独立模块,后续版本 |
| 合同管理模块 | 独立模块,后续版本 |
| 财务管理/提成结算 | 独立模块,后续版本 |
| 三网发布(安居客/链家/贝壳对接) | 独立模块,后续版本 |
| 数据报表/行程量化 | 独立模块,后续版本 |
| 在线充值/增值服务 | 独立模块,后续版本 |
| 任务管理OA任务/入职祝福) | 低优先 |
| 考勤管理 | 独立 HR 模块 |
| 审批流程 | 独立 OA 模块 |
| 智慧大屏 / VR换装 | 增值产品 |
| 房源广场(跨租户公共池) | 多租户复杂场景 |
---
## 4. 用户故事MVP 核心路径)
### Story 1 — 经纪人录入房源
> As a **一线经纪人**,
> I want to **快速录入一套二手住宅并上传图片和业主联系方式**,
> So that **这套房源的信息能被团队所有成员找到和跟进**.
**验收标准**
- 可在 3 分钟内完成住宅基本信息录入
- 上传图片后自动按分类展示
- 录入后即刻出现在房源列表
---
### Story 2 — 经纪人跟进房源
> As a **一线经纪人**,
> I want to **对我负责的房源记录每次跟进(面访/电话/钥匙/实勘)**,
> So that **我的跟进历史有据可查,团队不会重复联系同一业主**.
**验收标准**
- 跟进记录按时间线倒序展示
- 支持写入跟进、修改跟进、其他跟进(钥匙/委托/实勘)
- 敏感信息跟进只对有权限的人员可见
---
### Story 3 — 经纪人录入客源
> As a **一线经纪人**,
> I want to **录入意向购房/租房客户并跟进其需求变化**,
> So that **我能在合适时机将客户与合适房源匹配**.
**验收标准**
- 区分求购/求租两种意向
- 支持跟进记录
- 可安排带看并记录带看结果
---
### Story 4 — 转成交
> As a **一线经纪人**,
> I want to **将已达成交易的客源标记为"成交"并关联成交房源**,
> So that **成交数据进入系统留存,房源状态自动更新**.
**验收标准**
- 转成交时必须选择关联房源
- 成交后客源状态自动变为"成交客"
- 关联房源状态建议变更为"成交"(可手动确认)
---
### Story 5 — 店长查看团队数据
> As a **门店店长**,
> I want to **查看本门店所有员工的房源和客源列表**,
> So that **我能掌握团队整体情况并合理分配资源**.
**验收标准**
- 数据权限按部门隔离,店长可见本门店数据
- 可筛选查看特定员工的房源/客源
- 无法看到其他门店的数据
---
## 5. MVP 技术边界
| 约束 | 决策 |
|------|------|
| 租户数 | **单租户**种子阶段,多租户架构已就位但不激活多租户切换 UI |
| 数据量 | 目标支撑 **89,000 条**房源,测试阶段以 10,000 条压测 |
| 浏览器支持 | Chrome 最新版 / Edge 最新版,不支持 IE |
| 语言 | 简体中文,不做国际化 |
| 移动端 | **不做**Web 端 Desktop-first |
| 导出 | Excel/CSV 导出通过 Celery 异步,不超时 |
---
## 6. MVP 交付检查清单
在 MVP 正式上线前,以下项目必须全部勾选:
- [ ] 房源录入(住宅)完整流程可用
- [ ] 房源列表可筛选/排序/分页
- [ ] 客源录入(求购/求租)完整流程可用
- [ ] 带看创建与记录可用
- [ ] 转成交流程可用
- [ ] 楼盘数据可录入(为房源提供底座)
- [ ] 员工账号可创建/分配角色
- [ ] 权限隔离:经纪人只能看自己数据,店长能看本店数据
- [ ] 89,000 条数据量下列表查询 < 2 秒(含索引优化)
- [ ] 图片上传到 Cloudflare R2 可用
- [ ] 多租户 Schema 隔离验证通过
---
## 7. 版本路线图
| 版本 | 目标 | 核心功能 |
|------|------|---------|
| **v0.1 MVP** | 单租户种子验证 | P0 功能全部上线 |
| **v0.2** | 功能完善 | P1 功能上线,开始多租户测试 |
| **v0.3** | 商业化就绪 | Windows 客户端、多租户正式开放、系统配置完善 |
| **v1.0** | 正式发布 | 新房模块、合同/财务模块路线图确认 |
# Fonrey 房睿 — MVP 范围书
**Status**: Draft
**Author**: Product Team
**Last Updated**: 2026-04-24
**Version**: 1.0
> **For AI assistants**: 本文件定义 Phase 1MVP的边界。在任何功能实现前先对照本文确认是否在范围内。范围外的功能禁止在 MVP 阶段实现。
---
## 1. 产品背景与目标
**Fonrey房睿** 是一套面向中小型房产经纪公司的 B2B SaaS 管理平台,解决以下核心痛点:
- 房源/客源信息散乱,全靠人工记录
- 跟进记录缺失,数据流失严重
- 重复录入浪费大量经纪人时间
- 无法支撑 89,000+ 数据量级下的高效房客匹配
**MVP 目标**:在一家种子客户(单租户)环境下,完整跑通"录入房源 → 录入客源 → 匹配带看 → 成交"的核心业务链路。
---
## 2. MVP 核心功能清单Phase 1 必须实现)
### 2.1 优先级定义
| 优先级 | 含义 |
|--------|------|
| **P0** | MVP 上线前必须完成,阻断核心业务链路 |
| **P1** | MVP 上线后第一个迭代周期内完成 |
| **P2** | 已规划,列入路线图但不阻断上线 |
---
### 2.2 模块优先级矩阵
#### 🏠 房源管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 录入住宅(二手出售/出租) | **P0** | 核心业务入口 |
| 房源列表(二手&租赁) | **P0** | 含筛选、排序、分页 |
| 房源详情页 | **P0** | 含基本信息、产证、交易信息展示 |
| 跟进记录(全部/写入/修改/其他) | **P0** | 含钥匙、委托、实勘 |
| 图片管理(相册上传/分类/排序) | **P0** | 核心房源内容 |
| 业主联系人管理 | **P0** | 含新增/编辑/查看同业主房源 |
| 价格调整(调价/调价记录) | **P0** | 核心运营操作 |
| 房源状态变更(在售/暂缓/成交/下架) | **P0** | 状态机核心 |
| 房源维护完成度(诊断面板) | **P1** | 提升数据质量 |
| 敏感信息跟进(查看权限控制) | **P1** | 需配合权限模块 |
| 附件管理 | **P1** | 非阻断性 |
| 市场报盘 | **P1** | 运营辅助功能 |
| 价格解读 | **P1** | 分析辅助 |
| 录入别墅/商铺/商住/写字楼/其他 | **P2** | 住宅优先,商业类低频 |
| 全部商铺列表 / 全部写字楼列表 | **P2** | 配合 P2 录入功能 |
| 房源广场 | **P2** | 跨租户/公共池功能 |
#### 🏙️ 楼盘管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 楼盘列表 + 楼盘详情(楼盘信息/楼栋/结构) | **P0** | 房源数据底座,必须先行 |
| 区域管理(城区/商圈) | **P0** | 房源关联必须 |
| 楼盘照片管理 | **P1** | 数据完善 |
| 楼盘价格走势 | **P1** | 分析辅助 |
| 周边配套(学校管理) | **P1** | 补充信息 |
| 应用数据标准 | **P2** | 明确不做 |
#### 👥 客源管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 录入私客(求购/求租) | **P0** | 核心业务 |
| 私客列表(全部/求购/求租) | **P0** | 含筛选、排序 |
| 私客详情(基本信息/需求信息) | **P0** | |
| 跟进记录(全部/写入/修改/其他) | **P0** | |
| 带看管理(预约带看/新增带看) | **P0** | 房客匹配核心 |
| 联系人管理 | **P0** | |
| 客源状态变更(改等级/改状态) | **P0** | |
| 转公客 / 转成交 / 转无效 | **P0** | 生命周期核心 |
| 二手配房(智能匹配) | **P1** | 核心价值,但可后续迭代 |
| 客源解读 | **P1** | AI 辅助分析 |
| 客源信息概览 | **P1** | 汇总视图 |
| 客源收藏夹 | **P1** | 辅助功能 |
| 公客管理 | **P2** | 私客优先 |
| 成交客管理 | **P2** | |
| 暂缓私客 | **P2** | |
#### 🏢 组织人事
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 公司组织结构(部门/门店树) | **P0** | 权限系统基础 |
| 员工列表/员工详情 | **P0** | |
| 员工入职/账号创建 | **P0** | |
| 员工离职 / 调动 | **P1** | |
| 员工通讯录 | **P1** | |
| 异动记录 | **P1** | |
| 奖惩记录 | **P2** | |
| 职务管理 | **P1** | |
| 门店分布地图 | **P2** | |
#### 🔐 权限管理
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 角色管理(预设角色 + 自定义角色) | **P0** | 权限基础 |
| 人员权限列表 | **P0** | |
| 角色批量分配 | **P0** | |
| 功能权限(菜单级) | **P0** | |
| 数据权限(部门/个人/全司) | **P0** | |
| 字段级权限(敏感字段可见性) | **P1** | 配合房源/客源敏感信息 |
| 个人特定权限覆盖 | **P1** | |
#### 🔑 用户登录
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 账号密码登录 | **P0** | |
| 多租户识别(子域名/域名) | **P0** | |
| Token 管理 / 会话超时 | **P0** | |
| 短信验证码登录 | **P1** | |
| 密码重置 | **P1** | |
| 记住登录状态 | **P1** | |
#### ⚙️ 系统配置
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 首页设置 | **P1** | |
| 房源设置(字段必填/自定义字段/标签) | **P0** | 影响录入表单 |
| 相关方设置 | **P1** | |
| 客源设置(基本配置/参数配置) | **P1** | |
| 人事OA设置 | **P2** | |
| 交易设置 | **P2** | |
| 财务设置 | **P2** | |
| 合同设置 | **P2** | |
#### 🖥️ 系统管理(运营后台)
| 功能 | 优先级 | 说明 |
|------|--------|------|
| 租户管理(开通/暂停/配置) | **P1** | 单租户种子阶段可手动 |
| 系统健康监控 | **P1** | |
| 操作审计日志 | **P2** | |
| 灰度发布 / 滚动升级 | **P2** | |
#### 💻 客户端发布
| 功能 | 优先级 | 说明 |
|------|--------|------|
| Windows 桌面客户端(内置浏览器) | **P1** | 种子客户使用 Web 端可先行 |
| 自动更新机制 | **P1** | 配合客户端 |
---
## 3. 非目标Out of Scope — MVP 阶段绝对不做)
以下功能在 MVP 阶段**明确不实现**AI 生成代码时不得为这些功能预留接口或引入相关依赖:
| 功能 | 原因 |
|------|------|
| 移动端适配 | v2 规划 |
| 新房模块(新房管理/新房设置) | 独立模块,后续版本 |
| 合同管理模块 | 独立模块,后续版本 |
| 财务管理/提成结算 | 独立模块,后续版本 |
| 三网发布(安居客/链家/贝壳对接) | 独立模块,后续版本 |
| 数据报表/行程量化 | 独立模块,后续版本 |
| 在线充值/增值服务 | 独立模块,后续版本 |
| 任务管理OA任务/入职祝福) | 低优先 |
| 考勤管理 | 独立 HR 模块 |
| 审批流程 | 独立 OA 模块 |
| 智慧大屏 / VR换装 | 增值产品 |
| 房源广场(跨租户公共池) | 多租户复杂场景 |
---
## 4. 用户故事MVP 核心路径)
### Story 1 — 经纪人录入房源
> As a **一线经纪人**,
> I want to **快速录入一套二手住宅并上传图片和业主联系方式**,
> So that **这套房源的信息能被团队所有成员找到和跟进**.
**验收标准**
- 可在 3 分钟内完成住宅基本信息录入
- 上传图片后自动按分类展示
- 录入后即刻出现在房源列表
---
### Story 2 — 经纪人跟进房源
> As a **一线经纪人**,
> I want to **对我负责的房源记录每次跟进(面访/电话/钥匙/实勘)**,
> So that **我的跟进历史有据可查,团队不会重复联系同一业主**.
**验收标准**
- 跟进记录按时间线倒序展示
- 支持写入跟进、修改跟进、其他跟进(钥匙/委托/实勘)
- 敏感信息跟进只对有权限的人员可见
---
### Story 3 — 经纪人录入客源
> As a **一线经纪人**,
> I want to **录入意向购房/租房客户并跟进其需求变化**,
> So that **我能在合适时机将客户与合适房源匹配**.
**验收标准**
- 区分求购/求租两种意向
- 支持跟进记录
- 可安排带看并记录带看结果
---
### Story 4 — 转成交
> As a **一线经纪人**,
> I want to **将已达成交易的客源标记为"成交"并关联成交房源**,
> So that **成交数据进入系统留存,房源状态自动更新**.
**验收标准**
- 转成交时必须选择关联房源
- 成交后客源状态自动变为"成交客"
- 关联房源状态建议变更为"成交"(可手动确认)
---
### Story 5 — 店长查看团队数据
> As a **门店店长**,
> I want to **查看本门店所有员工的房源和客源列表**,
> So that **我能掌握团队整体情况并合理分配资源**.
**验收标准**
- 数据权限按部门隔离,店长可见本门店数据
- 可筛选查看特定员工的房源/客源
- 无法看到其他门店的数据
---
## 5. MVP 技术边界
| 约束 | 决策 |
|------|------|
| 租户数 | **单租户**种子阶段,多租户架构已就位但不激活多租户切换 UI |
| 数据量 | 目标支撑 **89,000 条**房源,测试阶段以 10,000 条压测 |
| 浏览器支持 | Chrome 最新版 / Edge 最新版,不支持 IE |
| 语言 | 简体中文,不做国际化 |
| 移动端 | **不做**Web 端 Desktop-first |
| 导出 | Excel/CSV 导出通过 Celery 异步,不超时 |
---
## 6. MVP 交付检查清单
在 MVP 正式上线前,以下项目必须全部勾选:
- [ ] 房源录入(住宅)完整流程可用
- [ ] 房源列表可筛选/排序/分页
- [ ] 客源录入(求购/求租)完整流程可用
- [ ] 带看创建与记录可用
- [ ] 转成交流程可用
- [ ] 楼盘数据可录入(为房源提供底座)
- [ ] 员工账号可创建/分配角色
- [ ] 权限隔离:经纪人只能看自己数据,店长能看本店数据
- [ ] 89,000 条数据量下列表查询 < 2 秒(含索引优化)
- [ ] 图片上传到 Cloudflare R2 可用
- [ ] 多租户 Schema 隔离验证通过
---
## 7. 版本路线图
| 版本 | 目标 | 核心功能 |
|------|------|---------|
| **v0.1 MVP** | 单租户种子验证 | P0 功能全部上线 |
| **v0.2** | 功能完善 | P1 功能上线,开始多租户测试 |
| **v0.3** | 商业化就绪 | Windows 客户端、多租户正式开放、系统配置完善 |
| **v1.0** | 正式发布 | 新房模块、合同/财务模块路线图确认 |

View File

@@ -1,407 +1,407 @@
# PRD: 客户端发布管理模块
**状态**: Draft
**作者**: 产品经理
**最后更新**: 2026-04-24v1.0 初稿)
**版本**: 1.0
**所属系统**: Fonrey 房产经纪管理系统
**关联模块**: 系统管理、权限管理
**干系人**: 工程负责人、运维负责人、系统管理员
---
## 1. 问题陈述
### 背景
Fonrey 房产经纪管理系统当前为纯 Web 应用,依赖用户自行通过浏览器访问。然而在实际部署场景中,经纪公司的终端设备环境高度复杂:
- **浏览器版本参差不齐**:经纪人使用的 Windows 设备可能运行 IE11、旧版 Edge、或未更新的 Chrome导致 HTMX + Alpine.js 等现代前端技术出现兼容性问题,系统体验碎片化
- **交付和部署门槛高**IT 能力薄弱的经纪公司无法独立配置浏览器访问方式URL 记忆成本高,容易访问错误版本
- **版本管理缺失**:后端服务升级后,用户仍可能使用旧版缓存页面操作,导致接口不兼容和功能异常
- **无官方入口**:用户通过私发链接访问系统,存在钓鱼仿冒风险,且无法统一品牌形象
### 目标用户
| 角色 | 使用场景 | 使用频率 |
|------|---------|----------|
| 一线经纪人 | 下载安装客户端、日常登录使用系统、接受自动更新 | 每日 |
| 店长/经理 | 同上 | 每日 |
| 系统管理员 | 发布新版本、管理安装包下载地址、监控客户端版本分布 | 按需 |
| IT 运维人员 | 维护更新服务器、签名证书、构建发布流水线 | 按发布周期 |
### 核心痛点
1. **无法控制用户使用的浏览器环境**,兼容性问题无法从根源解决
2. **升级依赖用户主动刷新浏览器**,后端 API 变更时旧客户端可能造成数据错误
3. **缺乏官方分发渠道**,无法向终端用户传递信任感和版本一致性保障
4. **SaaS 多租户管理系统需要统一、可控的客户端入口**,避免因客户端环境差异导致的支持成本上升
---
## 2. 目标与成功指标
| 目标 | 指标 | 当前基准 | 目标值 | 衡量周期 |
|------|------|---------|--------|---------|
| 消除浏览器兼容性问题 | 因浏览器兼容产生的支持工单数 | 待统计 | 降低 ≥ 90% | 上线后 60 天 |
| 提升版本一致性 | 在线用户中使用最新版本客户端的比例 | 0%(无客户端) | ≥ 95% | 版本发布后 7 天 |
| 降低部署门槛 | 新客户从获取安装包到完成首次登录的时间 | 无基准 | ≤ 10 分钟 | 上线后首批客户反馈 |
| 自动更新成功率 | 客户端自动更新完成率(收到更新通知 → 升级完成) | 无基准 | ≥ 98% | 每次版本发布后 48 小时 |
---
## 3. 非目标(本期不做)
- **不支持 macOS / Linux 客户端**:目标用户群体 99% 使用 WindowsmacOS 版本为后续规划
- **不支持移动端 AppiOS / Android**:移动端为 v2 规划,本期不涉及
- **不开发私有化部署的离线安装方案**:本期聚焦 SaaS 在线版,私有化部署另行规划
- **不包含客户端内置的离线模式**:系统需联网使用,客户端不缓存业务数据供离线访问
- **不包含客户端层面的安全加固(如代码混淆、反逆向)**:本期以功能交付为优先,安全加固列入后续迭代
---
## 4. 用户故事与验收标准
---
### Story 1经纪人下载并安装客户端
**As** 一线经纪人,**I want** 通过公司提供的网址下载一个安装程序并完成安装,**So that** 我可以立即打开登录界面使用 Fonrey 系统,无需手动配置浏览器。
**验收标准**
- [ ] 官方下载页面可通过指定 URL 访问,页面展示最新版本号、发布日期及下载按钮
- [ ] 下载产物为单一 `.exe` 安装包(或免安装便携版 `.zip`),文件大小控制在合理范围内
- [ ] 双击安装包后,安装向导步骤不超过 3 步(下一步 → 选择安装路径 → 安装),无需勾选额外组件
- [ ] 安装完成后,桌面自动生成快捷方式(图标为 Fonrey 品牌 Logo
- [ ] 首次启动后直接显示登录界面,无需用户手动输入任何 URL
- [ ] 安装包经过代码签名Windows SmartScreen 不弹出"无法识别的应用"警告
- [ ] 安装过程无需管理员权限(支持用户级安装到 `%APPDATA%` 目录),降低企业 IT 审批障碍
---
### Story 2经纪人使用客户端正常登录并使用系统
**As** 一线经纪人,**I want** 打开客户端后直接访问 Fonrey 系统的完整功能,**So that** 我的日常使用体验与使用 Chrome 浏览器无差异,且不受本机安装的浏览器版本影响。
**验收标准**
- [ ] 客户端内嵌现代 Chromium 内核(如基于 Electron 或 WebView2版本不低于 Chromium 100支持现代 Web 标准ES2020、CSS Grid、Fetch API 等)
- [ ] HTMX 局部刷新、Alpine.js 状态交互、Tailwind CSS 样式在客户端中渲染效果与 Chrome 最新版一致
- [ ] 支持 Cookie / Session 存储,登录状态在客户端关闭后保留(复用 Django Session 机制)
- [ ] 文件上传图片、附件、文件下载Excel 导出)在客户端中正常工作
- [ ] 客户端窗口支持最大化、最小化、拖拽调整大小,支持多显示器
- [ ] 客户端标题栏显示应用名称和当前版本号(如:`Fonrey 房睿 v1.2.3`
- [ ] 客户端不显示浏览器默认的地址栏、书签栏、扩展工具栏,保持沉浸式应用体验
---
### Story 3客户端感知新版本并自动升级
**As** 一线经纪人,**I want** 客户端在有新版本时自动提示并完成升级,**So that** 我无需手动下载安装,始终使用最新版本,不会因版本落后导致功能异常。
**验收标准**
- [ ] 客户端启动时及运行期间(每隔 4 小时)自动向更新服务器检查最新版本
- [ ] 有新版本时,客户端右下角弹出非阻断式通知:"发现新版本 vX.X.X点击立即更新",用户可选择"立即更新"或"稍后提醒"
- [ ] 点击"立即更新"后,客户端在后台静默下载更新包,进度条显示下载进度
- [ ] 下载完成后提示用户"更新已就绪,重启客户端完成安装",用户选择"立即重启"或"下次启动时安装"
- [ ] 重启后,新版本生效,标题栏版本号更新,历史会话自动恢复(用户无需重新登录)
- [ ] 支持强制更新模式:服务端可标记某版本为"强制升级",客户端不展示"稍后提醒"选项,必须升级后方可继续使用(用于重大 API 兼容性变更场景)
- [ ] 更新失败时(网络中断、磁盘空间不足等),客户端显示错误提示并保持当前版本正常运行,不影响用户当前操作
---
### Story 4系统管理员发布新版本
**As** 系统管理员,**I want** 通过管理后台上传新版客户端安装包并配置版本信息,**So that** 客户端能感知到更新并引导用户升级。
**验收标准**
- [ ] 系统管理后台提供"客户端版本管理"页面(位于系统管理模块下)
- [ ] 支持上传 `.exe` 安装包,并填写版本号(遵循 SemVer`X.Y.Z`)、版本说明(更新日志,支持 Markdown、发布日期
- [ ] 支持设置版本类型:普通更新 / 强制更新
- [ ] 支持设置版本状态:草稿(不对外生效)/ 已发布 / 已下线
- [ ] 发布后,更新服务器 API 即时返回最新版本信息,客户端下次检测时可感知
- [ ] 支持版本回滚:将指定历史版本重新设为"已发布",自动将当前版本标记为已下线
- [ ] 支持查看各版本的下载量和活跃客户端版本分布统计
---
### Story 5管理员监控客户端版本分布
**As** 系统管理员,**I want** 查看当前所有在线客户端的版本分布情况,**So that** 了解升级覆盖率,对仍在使用旧版本的客户端发出提醒或强制升级。
**验收标准**
- [ ] 客户端版本管理页面展示版本分布统计:各版本在线客户端数量及占比(饼图或条形图)
- [ ] 支持按租户维度查看版本分布(多租户场景下,区分不同经纪公司的版本使用情况)
- [ ] 支持对指定版本范围的用户推送"强制更新"通知(如:将所有低于 v1.5.0 的客户端标记为强制更新)
---
## 5. 功能详细说明
### 5.1 技术架构选型
#### 5.1.1 客户端技术方案
基于 Fonrey 现有技术栈Django + HTMX + Alpine.js + Tailwind CSS后端已采用 Docker Compose 部署),客户端本质是一个**内嵌现代 Chromium 内核的原生 Windows 应用外壳Shell**,其核心职责是:
1. 提供操作系统级原生窗口(标题栏、任务栏图标、托盘)
2. 内嵌高版本 Chromium 内核加载 Fonrey Web 应用 URL
3. 实现版本检测与自动更新逻辑
4. 处理文件下载、本地存储等 OS 级能力
**推荐方案Electron主选**
| 维度 | Electron | Tauri | WebView2 封装 |
|------|---------|-------|--------------|
| 内核控制 | ✅ 捆绑 Chromium100% 可控 | ❌ 依赖系统 WebView版本不可控 | ⚠️ 依赖 Windows 内置 WebView2 Runtime |
| 包体大小 | ~150MB可接受 | ~5MB | ~5MB |
| 生态成熟度 | ✅ 最成熟,社区最大 | ✅ 较新但活跃 | ⚠️ 微软官方但文档偏少 |
| 自动更新支持 | ✅ `electron-updater` 成熟方案 | ✅ 内置更新器 | ⚠️ 需自行实现 |
| 跨平台 | ✅ Win/Mac/Linux | ✅ | ❌ 仅 Windows |
| 团队技术匹配 | ✅ 主进程用 Node.js渲染层纯 Web | ⚠️ 主进程需 Rust | ✅ 主进程用 C# |
| **推荐度** | **✅ 主选** | 次选 | 备选 |
**选型决策**:采用 **Electron + electron-updater**。理由:
- 内嵌 Chromium 内核是本需求的核心约束Electron 是唯一能 100% 保证内核版本可控的主流方案
- `electron-updater` 配合 GitHub Releases 或自建 S3/R2 存储可实现完整的版本管理与自动更新流程,开发成本最低
- 渲染层完全复用 Fonrey 现有 Web 技术栈,无需新增前端框架学习成本
- 团队具备 JavaScript/Node.js 能力,主进程开发门槛可控
**技术决策**:客户端不内置任何业务逻辑,所有业务功能由服务端 Fonrey Web 应用提供。客户端仅负责加载 Web 应用、更新管理和 OS 级能力(窗口、托盘、文件下载路径)。
---
#### 5.1.2 更新服务架构
更新机制采用**差量检测 + 全量包下载**模式:
```
客户端启动 / 定时检测每4小时
GET /api/client/updates/latest?platform=win32&arch=x64&current_version=1.2.0
更新服务器Fonrey 后端 Django API
返回:{ latest_version, download_url, release_notes, force_update, checksum }
├── 无更新 → 继续正常运行
└── 有更新 → 弹出通知
├── 用户点击"立即更新" → 后台下载 .exe / NSIS 更新包
│ │
│ └── 下载完成 → 校验 SHA256 → 提示重启安装
└── 用户选择"稍后" → 下次启动再提示
```
**更新包存储**:上传至 Cloudflare R2与现有对象存储一致通过 Cloudflare CDN 加速下载,全国用户均可获得稳定下载速度。
**版本 API 端点**(新增至 Django 后端):
| 端点 | 方法 | 说明 |
|------|------|------|
| `/api/client/updates/latest/` | GET | 客户端查询最新版本,返回版本信息和下载 URL |
| `/api/client/updates/` | GET | 管理端查询版本列表(需认证) |
| `/api/client/updates/` | POST | 管理端发布新版本(需管理员权限) |
| `/api/client/updates/<id>/` | PATCH | 管理端修改版本状态(发布/下线/强制) |
---
#### 5.1.3 安装包签名与分发
**代码签名**
- 使用 EV 代码签名证书(推荐购买 DigiCert 或 Sectigo EV 证书)
- 通过 `electron-builder` 在 CI/CD 构建时自动签名
- 签名后安装包经 Windows SmartScreen 审核,用户安装时不触发安全警告
**安装包分发**
- 官方下载页:独立 HTML 页面托管于 Cloudflare Pages 或 Nginx 静态站
- 页面展示:最新版本号 + 发布日期 + 更新日志 + 下载按钮
- 下载 URL 格式:`https://download.fonrey.com/releases/v1.2.3/fonrey-setup-1.2.3-win.exe`
- 同时提供便携版Portable`fonrey-portable-1.2.3-win.zip`,供无安装权限的企业环境使用
---
### 5.2 客户端功能规格
#### 5.2.1 主窗口
| 属性 | 规格 |
|------|------|
| 默认窗口尺寸 | 1280 × 800最小1024 × 600 |
| 标题栏 | 显示 `Fonrey 房睿 v{version}`,含原生最小化/最大化/关闭按钮 |
| 内嵌 URL | 启动时加载 `https://{tenant}.fonrey.com`(或私有化部署地址,可配置) |
| 地址栏 | 不显示(沉浸式应用模式) |
| 右键菜单 | 仅保留"复制"/"粘贴"/"检查元素(仅开发模式)",移除"查看源代码"等浏览器默认项 |
| 外部链接 | 点击 `target="_blank"` 链接时,在系统默认浏览器中打开,不在客户端内新窗口打开 |
#### 5.2.2 系统托盘
| 功能 | 说明 |
|------|------|
| 托盘图标 | Fonrey Logo鼠标悬停显示 `Fonrey 房睿 - 已连接` / `- 离线` |
| 右键菜单 | 打开主窗口 / 检查更新 / 关于 / 退出 |
| 最小化行为 | 点击关闭按钮时最小化至托盘(不退出程序),用户通过托盘图标恢复窗口 |
#### 5.2.3 网络状态感知
| 状态 | 客户端行为 |
|------|-----------|
| 正常联网 | 加载 Fonrey Web 应用,状态栏显示"已连接" |
| 网络断开 | 显示全屏提示页:"网络连接已断开,请检查您的网络后重试",提供"重新连接"按钮 |
| 服务器维护 | 服务器返回 503 时,展示维护提示页(内容由服务端控制) |
#### 5.2.4 文件下载处理
- Excel 导出等文件下载触发时,客户端调用系统原生"另存为"对话框,用户选择保存路径
- 下载完成后,状态栏显示"下载完成,点击打开"提示,点击可直接打开文件
---
### 5.3 版本管理后台(系统管理模块新增页面)
**页面路径**:系统管理 → 客户端发布管理
#### 5.3.1 版本列表
| 列 | 说明 |
|----|------|
| 版本号 | SemVer 格式,如 `v1.2.3` |
| 版本类型 | 普通更新 / 强制更新(红色标签) |
| 状态 | 草稿 / 已发布(绿色)/ 已下线(灰色) |
| 发布时间 | 版本设为已发布的时间 |
| 下载量 | 该版本安装包被下载次数 |
| 操作 | 发布 / 下线 / 编辑 / 复制下载链接 |
#### 5.3.2 新增/编辑版本表单
| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| 版本号 | 文本输入 | 是 | 格式:`X.Y.Z`,自动校验 SemVer 格式 |
| 版本类型 | 单选 | 是 | 普通更新 / 强制更新 |
| 最低兼容版本 | 文本输入 | 否 | 低于该版本的客户端将被强制更新(如填写 `1.0.0`,则低于此版本的客户端强制升级) |
| 安装包EXE | 文件上传 | 是 | 上传至 Cloudflare R2最大 500MB |
| 便携版ZIP | 文件上传 | 否 | 同上 |
| SHA256 校验值 | 文本输入(自动填充) | 是 | 上传后系统自动计算并填充,用于客户端下载完成后校验完整性 |
| 更新日志 | Markdown 文本区域 | 是 | 展示给用户看的版本说明,最多 2000 字 |
| 发布说明(内部) | 文本区域 | 否 | 仅内部查看的技术说明,不对外展示 |
| 状态 | 单选 | 是 | 草稿 / 立即发布 |
#### 5.3.3 版本分布统计
| 图表 | 说明 |
|------|------|
| 版本分布饼图 | 按客户端版本号统计当前活跃用户数量及占比 |
| 升级进度趋势图 | 新版本发布后,各天累计升级完成的用户比例(折线图) |
| 租户版本明细 | 按租户(经纪公司)展示其员工的客户端版本分布 |
---
### 5.4 更新 API 规格
#### GET `/api/client/updates/latest/`
**请求参数Query String**
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `platform` | string | 是 | 平台标识,如 `win32` |
| `arch` | string | 是 | CPU 架构,如 `x64` / `arm64` |
| `current_version` | string | 是 | 客户端当前版本号,如 `1.2.0` |
**响应示例(有新版本)**
```json
{
"has_update": true,
"latest_version": "1.3.0",
"force_update": false,
"download_url": "https://download.fonrey.com/releases/v1.3.0/fonrey-setup-1.3.0-win.exe",
"portable_url": "https://download.fonrey.com/releases/v1.3.0/fonrey-portable-1.3.0-win.zip",
"checksum_sha256": "a1b2c3d4...",
"release_notes": "## v1.3.0 更新内容\n- 新增客源智能配房功能\n- 修复房源列表筛选条件保存异常",
"release_date": "2026-05-01"
}
```
**响应示例(已是最新)**
```json
{
"has_update": false,
"latest_version": "1.3.0"
}
```
---
## 6. 技术实现注意事项
### 6.1 依赖关系
| 依赖项 | 说明 | 负责方 | 风险等级 |
|--------|------|--------|---------|
| Electron 框架 | 客户端技术基础,需评估 LicenseMIT商业可用 | 前端/客户端工程师 | 低 |
| EV 代码签名证书 | 需提前申请EV 证书审核周期 1-2 周 | IT/运维 | 中(需提前排期) |
| Cloudflare R2 存储桶 | 存放安装包,利用现有账号新增 bucket | 运维 | 低 |
| `electron-updater` | 自动更新库,需配合更新 API 端点实现 | 客户端工程师 | 低 |
| Django 更新 API | 新增 `/api/client/updates/` 相关接口 | 后端工程师 | 低 |
| CI/CD 构建流水线 | 自动构建、签名、上传安装包 | 运维/DevOps | 中 |
### 6.2 已知风险
| 风险 | 可能性 | 影响 | 缓解措施 |
|------|--------|------|---------|
| EV 证书申请延迟 | 中 | 高(无签名包无法正常分发) | MVP 阶段可使用普通 OV 证书临时过渡,但需向用户说明安全警告原因 |
| Electron 包体过大导致下载放弃 | 低 | 中 | 使用 `electron-builder``asar` 压缩 + 分片下载;首包控制在 150MB 以内 |
| 企业网络拦截 CDN 下载 | 中 | 中 | 提供备用下载 URL直连服务器支持客户手动下载后本地安装 |
| 自动更新期间用户强制关闭 | 低 | 低 | 更新包下载完成后才替换原文件,下载中断不影响现有版本正常运行 |
| 多租户场景下 URL 配置问题 | 低 | 高 | 客户端启动时加载的 URL 通过配置文件指定支持定制化部署SaaS 版统一指向主域名 |
### 6.3 开放问题(开发启动前必须解决)
- [ ] **租户 URL 如何分发到客户端?** 选项 A客户端硬编码主域名由服务端重定向到租户子域`fonrey.com``{tenant}.fonrey.com`);选项 B安装包内置配置文件由销售/运维在分发给客户前填写租户子域。——**Owner**: 产品 + 工程 **Deadline**: 开发启动前
- [ ] **代码签名证书采购主体和预算是否确认?****Owner**: IT 负责人 **Deadline**: 立项后 1 周
- [ ] **CI/CD 平台选型是否确定?**GitHub Actions / Jenkins / 其他)— **Owner**: 运维负责人 **Deadline**: 开发启动前
- [ ] **便携版Portable ZIP是否纳入 v1 范围?** 便携版可解决企业无安装权限场景,但增加测试成本。— **Owner**: PM **Deadline**: 立项后 1 周
---
## 7. 发布计划
| 阶段 | 时间 | 受众 | 成功门槛 |
|------|------|------|---------|
| 内部 Alpha | 开发完成后 1 周 | 内部团队 + 1 家种子客户 | 核心流程无 P0 Bug自动更新机制验证通过 |
| 封闭 Beta | Alpha + 2 周 | 3-5 家头部客户 | 安装成功率 ≥ 95%,自动更新成功率 ≥ 95%,无 P0/P1 Bug |
| 正式发布GA | Beta + 1 周 | 全部客户 | Beta 阶段目标达成 |
**回滚标准**:若正式发布后 24 小时内出现以下情况,立即下线该版本并恢复上一稳定版本为"已发布"
- 自动更新失败率 > 5%
- 客户端白屏/崩溃率 > 2%
- 收到 P0 级安全漏洞报告
---
## 8. 附录
### 8.1 竞品参考
| 产品 | 客户端方案 | 更新机制 |
|------|-----------|---------|
| 企业微信 | Electron + 自研内核 | 强制更新,启动时自动下载 |
| 飞书 | Electron | 后台静默更新,重启生效 |
| 钉钉 | Electron | 同上 |
> 房产经纪行业的竞品(如房客多、云客优)均采用 Electron 方案,验证了技术路线的合理性。
### 8.2 术语表
| 术语 | 定义 |
|------|------|
| SemVer | 语义化版本控制Semantic Versioning`主版本号.次版本号.补丁号`,如 `1.2.3` |
| Electron | 由 GitHub 开发的开源框架,允许使用 Web 技术HTML/CSS/JS构建跨平台桌面应用内嵌 Chromium 和 Node.js |
| electron-updater | Electron 生态中成熟的自动更新库,支持增量更新和全量更新 |
| EV 证书 | Extended Validation 代码签名证书,由 CA 机构颁发,可消除 Windows SmartScreen 安全警告 |
| SHA256 | 安全散列算法,用于验证下载文件的完整性,防止篡改或下载损坏 |
| Portable | 便携版,无需安装,解压即用,适合无管理员权限的企业环境 |
# PRD: 客户端发布管理模块
**状态**: Draft
**作者**: 产品经理
**最后更新**: 2026-04-24v1.0 初稿)
**版本**: 1.0
**所属系统**: Fonrey 房产经纪管理系统
**关联模块**: 系统管理、权限管理
**干系人**: 工程负责人、运维负责人、系统管理员
---
## 1. 问题陈述
### 背景
Fonrey 房产经纪管理系统当前为纯 Web 应用,依赖用户自行通过浏览器访问。然而在实际部署场景中,经纪公司的终端设备环境高度复杂:
- **浏览器版本参差不齐**:经纪人使用的 Windows 设备可能运行 IE11、旧版 Edge、或未更新的 Chrome导致 HTMX + Alpine.js 等现代前端技术出现兼容性问题,系统体验碎片化
- **交付和部署门槛高**IT 能力薄弱的经纪公司无法独立配置浏览器访问方式URL 记忆成本高,容易访问错误版本
- **版本管理缺失**:后端服务升级后,用户仍可能使用旧版缓存页面操作,导致接口不兼容和功能异常
- **无官方入口**:用户通过私发链接访问系统,存在钓鱼仿冒风险,且无法统一品牌形象
### 目标用户
| 角色 | 使用场景 | 使用频率 |
|------|---------|----------|
| 一线经纪人 | 下载安装客户端、日常登录使用系统、接受自动更新 | 每日 |
| 店长/经理 | 同上 | 每日 |
| 系统管理员 | 发布新版本、管理安装包下载地址、监控客户端版本分布 | 按需 |
| IT 运维人员 | 维护更新服务器、签名证书、构建发布流水线 | 按发布周期 |
### 核心痛点
1. **无法控制用户使用的浏览器环境**,兼容性问题无法从根源解决
2. **升级依赖用户主动刷新浏览器**,后端 API 变更时旧客户端可能造成数据错误
3. **缺乏官方分发渠道**,无法向终端用户传递信任感和版本一致性保障
4. **SaaS 多租户管理系统需要统一、可控的客户端入口**,避免因客户端环境差异导致的支持成本上升
---
## 2. 目标与成功指标
| 目标 | 指标 | 当前基准 | 目标值 | 衡量周期 |
|------|------|---------|--------|---------|
| 消除浏览器兼容性问题 | 因浏览器兼容产生的支持工单数 | 待统计 | 降低 ≥ 90% | 上线后 60 天 |
| 提升版本一致性 | 在线用户中使用最新版本客户端的比例 | 0%(无客户端) | ≥ 95% | 版本发布后 7 天 |
| 降低部署门槛 | 新客户从获取安装包到完成首次登录的时间 | 无基准 | ≤ 10 分钟 | 上线后首批客户反馈 |
| 自动更新成功率 | 客户端自动更新完成率(收到更新通知 → 升级完成) | 无基准 | ≥ 98% | 每次版本发布后 48 小时 |
---
## 3. 非目标(本期不做)
- **不支持 macOS / Linux 客户端**:目标用户群体 99% 使用 WindowsmacOS 版本为后续规划
- **不支持移动端 AppiOS / Android**:移动端为 v2 规划,本期不涉及
- **不开发私有化部署的离线安装方案**:本期聚焦 SaaS 在线版,私有化部署另行规划
- **不包含客户端内置的离线模式**:系统需联网使用,客户端不缓存业务数据供离线访问
- **不包含客户端层面的安全加固(如代码混淆、反逆向)**:本期以功能交付为优先,安全加固列入后续迭代
---
## 4. 用户故事与验收标准
---
### Story 1经纪人下载并安装客户端
**As** 一线经纪人,**I want** 通过公司提供的网址下载一个安装程序并完成安装,**So that** 我可以立即打开登录界面使用 Fonrey 系统,无需手动配置浏览器。
**验收标准**
- [ ] 官方下载页面可通过指定 URL 访问,页面展示最新版本号、发布日期及下载按钮
- [ ] 下载产物为单一 `.exe` 安装包(或免安装便携版 `.zip`),文件大小控制在合理范围内
- [ ] 双击安装包后,安装向导步骤不超过 3 步(下一步 → 选择安装路径 → 安装),无需勾选额外组件
- [ ] 安装完成后,桌面自动生成快捷方式(图标为 Fonrey 品牌 Logo
- [ ] 首次启动后直接显示登录界面,无需用户手动输入任何 URL
- [ ] 安装包经过代码签名Windows SmartScreen 不弹出"无法识别的应用"警告
- [ ] 安装过程无需管理员权限(支持用户级安装到 `%APPDATA%` 目录),降低企业 IT 审批障碍
---
### Story 2经纪人使用客户端正常登录并使用系统
**As** 一线经纪人,**I want** 打开客户端后直接访问 Fonrey 系统的完整功能,**So that** 我的日常使用体验与使用 Chrome 浏览器无差异,且不受本机安装的浏览器版本影响。
**验收标准**
- [ ] 客户端内嵌现代 Chromium 内核(如基于 Electron 或 WebView2版本不低于 Chromium 100支持现代 Web 标准ES2020、CSS Grid、Fetch API 等)
- [ ] HTMX 局部刷新、Alpine.js 状态交互、Tailwind CSS 样式在客户端中渲染效果与 Chrome 最新版一致
- [ ] 支持 Cookie / Session 存储,登录状态在客户端关闭后保留(复用 Django Session 机制)
- [ ] 文件上传图片、附件、文件下载Excel 导出)在客户端中正常工作
- [ ] 客户端窗口支持最大化、最小化、拖拽调整大小,支持多显示器
- [ ] 客户端标题栏显示应用名称和当前版本号(如:`Fonrey 房睿 v1.2.3`
- [ ] 客户端不显示浏览器默认的地址栏、书签栏、扩展工具栏,保持沉浸式应用体验
---
### Story 3客户端感知新版本并自动升级
**As** 一线经纪人,**I want** 客户端在有新版本时自动提示并完成升级,**So that** 我无需手动下载安装,始终使用最新版本,不会因版本落后导致功能异常。
**验收标准**
- [ ] 客户端启动时及运行期间(每隔 4 小时)自动向更新服务器检查最新版本
- [ ] 有新版本时,客户端右下角弹出非阻断式通知:"发现新版本 vX.X.X点击立即更新",用户可选择"立即更新"或"稍后提醒"
- [ ] 点击"立即更新"后,客户端在后台静默下载更新包,进度条显示下载进度
- [ ] 下载完成后提示用户"更新已就绪,重启客户端完成安装",用户选择"立即重启"或"下次启动时安装"
- [ ] 重启后,新版本生效,标题栏版本号更新,历史会话自动恢复(用户无需重新登录)
- [ ] 支持强制更新模式:服务端可标记某版本为"强制升级",客户端不展示"稍后提醒"选项,必须升级后方可继续使用(用于重大 API 兼容性变更场景)
- [ ] 更新失败时(网络中断、磁盘空间不足等),客户端显示错误提示并保持当前版本正常运行,不影响用户当前操作
---
### Story 4系统管理员发布新版本
**As** 系统管理员,**I want** 通过管理后台上传新版客户端安装包并配置版本信息,**So that** 客户端能感知到更新并引导用户升级。
**验收标准**
- [ ] 系统管理后台提供"客户端版本管理"页面(位于系统管理模块下)
- [ ] 支持上传 `.exe` 安装包,并填写版本号(遵循 SemVer`X.Y.Z`)、版本说明(更新日志,支持 Markdown、发布日期
- [ ] 支持设置版本类型:普通更新 / 强制更新
- [ ] 支持设置版本状态:草稿(不对外生效)/ 已发布 / 已下线
- [ ] 发布后,更新服务器 API 即时返回最新版本信息,客户端下次检测时可感知
- [ ] 支持版本回滚:将指定历史版本重新设为"已发布",自动将当前版本标记为已下线
- [ ] 支持查看各版本的下载量和活跃客户端版本分布统计
---
### Story 5管理员监控客户端版本分布
**As** 系统管理员,**I want** 查看当前所有在线客户端的版本分布情况,**So that** 了解升级覆盖率,对仍在使用旧版本的客户端发出提醒或强制升级。
**验收标准**
- [ ] 客户端版本管理页面展示版本分布统计:各版本在线客户端数量及占比(饼图或条形图)
- [ ] 支持按租户维度查看版本分布(多租户场景下,区分不同经纪公司的版本使用情况)
- [ ] 支持对指定版本范围的用户推送"强制更新"通知(如:将所有低于 v1.5.0 的客户端标记为强制更新)
---
## 5. 功能详细说明
### 5.1 技术架构选型
#### 5.1.1 客户端技术方案
基于 Fonrey 现有技术栈Django + HTMX + Alpine.js + Tailwind CSS后端已采用 Docker Compose 部署),客户端本质是一个**内嵌现代 Chromium 内核的原生 Windows 应用外壳Shell**,其核心职责是:
1. 提供操作系统级原生窗口(标题栏、任务栏图标、托盘)
2. 内嵌高版本 Chromium 内核加载 Fonrey Web 应用 URL
3. 实现版本检测与自动更新逻辑
4. 处理文件下载、本地存储等 OS 级能力
**推荐方案Electron主选**
| 维度 | Electron | Tauri | WebView2 封装 |
|------|---------|-------|--------------|
| 内核控制 | ✅ 捆绑 Chromium100% 可控 | ❌ 依赖系统 WebView版本不可控 | ⚠️ 依赖 Windows 内置 WebView2 Runtime |
| 包体大小 | ~150MB可接受 | ~5MB | ~5MB |
| 生态成熟度 | ✅ 最成熟,社区最大 | ✅ 较新但活跃 | ⚠️ 微软官方但文档偏少 |
| 自动更新支持 | ✅ `electron-updater` 成熟方案 | ✅ 内置更新器 | ⚠️ 需自行实现 |
| 跨平台 | ✅ Win/Mac/Linux | ✅ | ❌ 仅 Windows |
| 团队技术匹配 | ✅ 主进程用 Node.js渲染层纯 Web | ⚠️ 主进程需 Rust | ✅ 主进程用 C# |
| **推荐度** | **✅ 主选** | 次选 | 备选 |
**选型决策**:采用 **Electron + electron-updater**。理由:
- 内嵌 Chromium 内核是本需求的核心约束Electron 是唯一能 100% 保证内核版本可控的主流方案
- `electron-updater` 配合 GitHub Releases 或自建 S3/R2 存储可实现完整的版本管理与自动更新流程,开发成本最低
- 渲染层完全复用 Fonrey 现有 Web 技术栈,无需新增前端框架学习成本
- 团队具备 JavaScript/Node.js 能力,主进程开发门槛可控
**技术决策**:客户端不内置任何业务逻辑,所有业务功能由服务端 Fonrey Web 应用提供。客户端仅负责加载 Web 应用、更新管理和 OS 级能力(窗口、托盘、文件下载路径)。
---
#### 5.1.2 更新服务架构
更新机制采用**差量检测 + 全量包下载**模式:
```
客户端启动 / 定时检测每4小时
GET /api/client/updates/latest?platform=win32&arch=x64&current_version=1.2.0
更新服务器Fonrey 后端 Django API
返回:{ latest_version, download_url, release_notes, force_update, checksum }
├── 无更新 → 继续正常运行
└── 有更新 → 弹出通知
├── 用户点击"立即更新" → 后台下载 .exe / NSIS 更新包
│ │
│ └── 下载完成 → 校验 SHA256 → 提示重启安装
└── 用户选择"稍后" → 下次启动再提示
```
**更新包存储**:上传至 Cloudflare R2与现有对象存储一致通过 Cloudflare CDN 加速下载,全国用户均可获得稳定下载速度。
**版本 API 端点**(新增至 Django 后端):
| 端点 | 方法 | 说明 |
|------|------|------|
| `/api/client/updates/latest/` | GET | 客户端查询最新版本,返回版本信息和下载 URL |
| `/api/client/updates/` | GET | 管理端查询版本列表(需认证) |
| `/api/client/updates/` | POST | 管理端发布新版本(需管理员权限) |
| `/api/client/updates/<id>/` | PATCH | 管理端修改版本状态(发布/下线/强制) |
---
#### 5.1.3 安装包签名与分发
**代码签名**
- 使用 EV 代码签名证书(推荐购买 DigiCert 或 Sectigo EV 证书)
- 通过 `electron-builder` 在 CI/CD 构建时自动签名
- 签名后安装包经 Windows SmartScreen 审核,用户安装时不触发安全警告
**安装包分发**
- 官方下载页:独立 HTML 页面托管于 Cloudflare Pages 或 Nginx 静态站
- 页面展示:最新版本号 + 发布日期 + 更新日志 + 下载按钮
- 下载 URL 格式:`https://download.fonrey.com/releases/v1.2.3/fonrey-setup-1.2.3-win.exe`
- 同时提供便携版Portable`fonrey-portable-1.2.3-win.zip`,供无安装权限的企业环境使用
---
### 5.2 客户端功能规格
#### 5.2.1 主窗口
| 属性 | 规格 |
|------|------|
| 默认窗口尺寸 | 1280 × 800最小1024 × 600 |
| 标题栏 | 显示 `Fonrey 房睿 v{version}`,含原生最小化/最大化/关闭按钮 |
| 内嵌 URL | 启动时加载 `https://{tenant}.fonrey.com`(或私有化部署地址,可配置) |
| 地址栏 | 不显示(沉浸式应用模式) |
| 右键菜单 | 仅保留"复制"/"粘贴"/"检查元素(仅开发模式)",移除"查看源代码"等浏览器默认项 |
| 外部链接 | 点击 `target="_blank"` 链接时,在系统默认浏览器中打开,不在客户端内新窗口打开 |
#### 5.2.2 系统托盘
| 功能 | 说明 |
|------|------|
| 托盘图标 | Fonrey Logo鼠标悬停显示 `Fonrey 房睿 - 已连接` / `- 离线` |
| 右键菜单 | 打开主窗口 / 检查更新 / 关于 / 退出 |
| 最小化行为 | 点击关闭按钮时最小化至托盘(不退出程序),用户通过托盘图标恢复窗口 |
#### 5.2.3 网络状态感知
| 状态 | 客户端行为 |
|------|-----------|
| 正常联网 | 加载 Fonrey Web 应用,状态栏显示"已连接" |
| 网络断开 | 显示全屏提示页:"网络连接已断开,请检查您的网络后重试",提供"重新连接"按钮 |
| 服务器维护 | 服务器返回 503 时,展示维护提示页(内容由服务端控制) |
#### 5.2.4 文件下载处理
- Excel 导出等文件下载触发时,客户端调用系统原生"另存为"对话框,用户选择保存路径
- 下载完成后,状态栏显示"下载完成,点击打开"提示,点击可直接打开文件
---
### 5.3 版本管理后台(系统管理模块新增页面)
**页面路径**:系统管理 → 客户端发布管理
#### 5.3.1 版本列表
| 列 | 说明 |
|----|------|
| 版本号 | SemVer 格式,如 `v1.2.3` |
| 版本类型 | 普通更新 / 强制更新(红色标签) |
| 状态 | 草稿 / 已发布(绿色)/ 已下线(灰色) |
| 发布时间 | 版本设为已发布的时间 |
| 下载量 | 该版本安装包被下载次数 |
| 操作 | 发布 / 下线 / 编辑 / 复制下载链接 |
#### 5.3.2 新增/编辑版本表单
| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| 版本号 | 文本输入 | 是 | 格式:`X.Y.Z`,自动校验 SemVer 格式 |
| 版本类型 | 单选 | 是 | 普通更新 / 强制更新 |
| 最低兼容版本 | 文本输入 | 否 | 低于该版本的客户端将被强制更新(如填写 `1.0.0`,则低于此版本的客户端强制升级) |
| 安装包EXE | 文件上传 | 是 | 上传至 Cloudflare R2最大 500MB |
| 便携版ZIP | 文件上传 | 否 | 同上 |
| SHA256 校验值 | 文本输入(自动填充) | 是 | 上传后系统自动计算并填充,用于客户端下载完成后校验完整性 |
| 更新日志 | Markdown 文本区域 | 是 | 展示给用户看的版本说明,最多 2000 字 |
| 发布说明(内部) | 文本区域 | 否 | 仅内部查看的技术说明,不对外展示 |
| 状态 | 单选 | 是 | 草稿 / 立即发布 |
#### 5.3.3 版本分布统计
| 图表 | 说明 |
|------|------|
| 版本分布饼图 | 按客户端版本号统计当前活跃用户数量及占比 |
| 升级进度趋势图 | 新版本发布后,各天累计升级完成的用户比例(折线图) |
| 租户版本明细 | 按租户(经纪公司)展示其员工的客户端版本分布 |
---
### 5.4 更新 API 规格
#### GET `/api/client/updates/latest/`
**请求参数Query String**
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `platform` | string | 是 | 平台标识,如 `win32` |
| `arch` | string | 是 | CPU 架构,如 `x64` / `arm64` |
| `current_version` | string | 是 | 客户端当前版本号,如 `1.2.0` |
**响应示例(有新版本)**
```json
{
"has_update": true,
"latest_version": "1.3.0",
"force_update": false,
"download_url": "https://download.fonrey.com/releases/v1.3.0/fonrey-setup-1.3.0-win.exe",
"portable_url": "https://download.fonrey.com/releases/v1.3.0/fonrey-portable-1.3.0-win.zip",
"checksum_sha256": "a1b2c3d4...",
"release_notes": "## v1.3.0 更新内容\n- 新增客源智能配房功能\n- 修复房源列表筛选条件保存异常",
"release_date": "2026-05-01"
}
```
**响应示例(已是最新)**
```json
{
"has_update": false,
"latest_version": "1.3.0"
}
```
---
## 6. 技术实现注意事项
### 6.1 依赖关系
| 依赖项 | 说明 | 负责方 | 风险等级 |
|--------|------|--------|---------|
| Electron 框架 | 客户端技术基础,需评估 LicenseMIT商业可用 | 前端/客户端工程师 | 低 |
| EV 代码签名证书 | 需提前申请EV 证书审核周期 1-2 周 | IT/运维 | 中(需提前排期) |
| Cloudflare R2 存储桶 | 存放安装包,利用现有账号新增 bucket | 运维 | 低 |
| `electron-updater` | 自动更新库,需配合更新 API 端点实现 | 客户端工程师 | 低 |
| Django 更新 API | 新增 `/api/client/updates/` 相关接口 | 后端工程师 | 低 |
| CI/CD 构建流水线 | 自动构建、签名、上传安装包 | 运维/DevOps | 中 |
### 6.2 已知风险
| 风险 | 可能性 | 影响 | 缓解措施 |
|------|--------|------|---------|
| EV 证书申请延迟 | 中 | 高(无签名包无法正常分发) | MVP 阶段可使用普通 OV 证书临时过渡,但需向用户说明安全警告原因 |
| Electron 包体过大导致下载放弃 | 低 | 中 | 使用 `electron-builder``asar` 压缩 + 分片下载;首包控制在 150MB 以内 |
| 企业网络拦截 CDN 下载 | 中 | 中 | 提供备用下载 URL直连服务器支持客户手动下载后本地安装 |
| 自动更新期间用户强制关闭 | 低 | 低 | 更新包下载完成后才替换原文件,下载中断不影响现有版本正常运行 |
| 多租户场景下 URL 配置问题 | 低 | 高 | 客户端启动时加载的 URL 通过配置文件指定支持定制化部署SaaS 版统一指向主域名 |
### 6.3 开放问题(开发启动前必须解决)
- [ ] **租户 URL 如何分发到客户端?** 选项 A客户端硬编码主域名由服务端重定向到租户子域`fonrey.com``{tenant}.fonrey.com`);选项 B安装包内置配置文件由销售/运维在分发给客户前填写租户子域。——**Owner**: 产品 + 工程 **Deadline**: 开发启动前
- [ ] **代码签名证书采购主体和预算是否确认?****Owner**: IT 负责人 **Deadline**: 立项后 1 周
- [ ] **CI/CD 平台选型是否确定?**GitHub Actions / Jenkins / 其他)— **Owner**: 运维负责人 **Deadline**: 开发启动前
- [ ] **便携版Portable ZIP是否纳入 v1 范围?** 便携版可解决企业无安装权限场景,但增加测试成本。— **Owner**: PM **Deadline**: 立项后 1 周
---
## 7. 发布计划
| 阶段 | 时间 | 受众 | 成功门槛 |
|------|------|------|---------|
| 内部 Alpha | 开发完成后 1 周 | 内部团队 + 1 家种子客户 | 核心流程无 P0 Bug自动更新机制验证通过 |
| 封闭 Beta | Alpha + 2 周 | 3-5 家头部客户 | 安装成功率 ≥ 95%,自动更新成功率 ≥ 95%,无 P0/P1 Bug |
| 正式发布GA | Beta + 1 周 | 全部客户 | Beta 阶段目标达成 |
**回滚标准**:若正式发布后 24 小时内出现以下情况,立即下线该版本并恢复上一稳定版本为"已发布"
- 自动更新失败率 > 5%
- 客户端白屏/崩溃率 > 2%
- 收到 P0 级安全漏洞报告
---
## 8. 附录
### 8.1 竞品参考
| 产品 | 客户端方案 | 更新机制 |
|------|-----------|---------|
| 企业微信 | Electron + 自研内核 | 强制更新,启动时自动下载 |
| 飞书 | Electron | 后台静默更新,重启生效 |
| 钉钉 | Electron | 同上 |
> 房产经纪行业的竞品(如房客多、云客优)均采用 Electron 方案,验证了技术路线的合理性。
### 8.2 术语表
| 术语 | 定义 |
|------|------|
| SemVer | 语义化版本控制Semantic Versioning`主版本号.次版本号.补丁号`,如 `1.2.3` |
| Electron | 由 GitHub 开发的开源框架,允许使用 Web 技术HTML/CSS/JS构建跨平台桌面应用内嵌 Chromium 和 Node.js |
| electron-updater | Electron 生态中成熟的自动更新库,支持增量更新和全量更新 |
| EV 证书 | Extended Validation 代码签名证书,由 CA 机构颁发,可消除 Windows SmartScreen 安全警告 |
| SHA256 | 安全散列算法,用于验证下载文件的完整性,防止篡改或下载损坏 |
| Portable | 便携版,无需安装,解压即用,适合无管理员权限的企业环境 |

File diff suppressed because it is too large Load Diff

View File

@@ -1,309 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-04-25T00:00:00.000Z" agent="OpenCode" version="21.0.0">
<!-- ============================================================
5.4.1 找回用户名流程
============================================================ -->
<diagram id="recover-username" name="5.4.1 找回用户名流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="t1" value="5.4.1 找回用户名流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="u1" value="用户点击「忘记用户名」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="80" width="300" height="50" as="geometry" />
</mxCell>
<!-- Decision: Is email format valid? -->
<mxCell id="u2" value="展示「找回用户名」页面
(邮箱输入框 + 发送按钮)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="170" width="350" height="50" as="geometry" />
</mxCell>
<!-- User inputs email -->
<mxCell id="u3" value="用户输入邮箱并点击「发送」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="260" width="350" height="50" as="geometry" />
</mxCell>
<!-- Decision: Email format valid? -->
<mxCell id="u4" value="邮箱格式校验通过?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="350" width="300" height="70" as="geometry" />
</mxCell>
<!-- Format invalid -->
<mxCell id="u5" value="提示「请输入有效的邮箱地址」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="360" width="220" height="50" as="geometry" />
</mxCell>
<!-- Backend query -->
<mxCell id="u6" value="服务端查询邮箱是否绑定账号
(不向前端返回查询结果)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="470" width="350" height="60" as="geometry" />
</mxCell>
<!-- Unified response to frontend -->
<mxCell id="u7" value="统一响应前端:
「如该邮箱已绑定账号,您将收到邮件」
发送按钮进入 60 秒倒计时" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="580" width="350" height="70" as="geometry" />
</mxCell>
<!-- Decision: Email exists? -->
<mxCell id="u8" value="邮箱已绑定 Tenant Admin 账号?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="475" width="240" height="70" as="geometry" />
</mxCell>
<!-- Email found: send email -->
<mxCell id="u9" value="后台:异步发送邮件
(包含用户名、发送时间)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="580" width="220" height="60" as="geometry" />
</mxCell>
<!-- Email not found: silent -->
<mxCell id="u10" value="后台:静默处理
(不发送邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="660" width="220" height="50" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="u11" value="同一邮箱 1 小时内已发送 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="700" width="240" height="70" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="u12" value="拒绝发送
(达到频率上限)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="715" width="160" height="50" as="geometry" />
</mxCell>
<!-- User receives email -->
<mxCell id="u13" value="用户查收邮件,获取用户名" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="810" width="220" height="50" as="geometry" />
</mxCell>
<!-- Return to login -->
<mxCell id="u14" value="点击「返回登录」
回到登录界面" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="700" width="300" height="50" as="geometry" />
</mxCell>
<!-- Edges -->
<mxCell id="e1" edge="1" source="u1" target="u2" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e2" edge="1" source="u2" target="u3" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e3" edge="1" source="u3" target="u4" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e4" value="否" edge="1" source="u4" target="u5" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="385" /></Array></mxGeometry>
</mxCell>
<mxCell id="e5" value="" edge="1" source="u5" target="u3" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="730" y="285" /></Array></mxGeometry>
</mxCell>
<mxCell id="e6" value="是" edge="1" source="u4" target="u6" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e7" edge="1" source="u6" target="u7" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e8" edge="1" source="u6" target="u8" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="600" y="500" /><mxPoint x="630" y="510" /></Array></mxGeometry>
</mxCell>
<mxCell id="e9" value="是" edge="1" source="u8" target="u11" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e10" value="否(普通员工邮箱或不存在)" edge="1" source="u8" target="u10" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="660" as="targetPoint" /></mxGeometry>
</mxCell>
<mxCell id="e11" value="否(未超限)" edge="1" source="u11" target="u9" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e12" value="是(超过 3 次)" edge="1" source="u11" target="u12" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="735" /></Array></mxGeometry>
</mxCell>
<mxCell id="e13" edge="1" source="u9" target="u13" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e14" edge="1" source="u13" target="u14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="750" y="835" /><mxPoint x="425" y="835" /><mxPoint x="425" y="750" /></Array></mxGeometry>
</mxCell>
<mxCell id="e15" edge="1" source="u7" target="u14" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<!-- ============================================================
5.4.2 找回密码流程
============================================================ -->
<diagram id="recover-password" name="5.4.2 找回密码流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1300" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="title" value="5.4.2 找回密码流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- ===== STEP 1 Header ===== -->
<mxCell id="step1hdr" value="步骤一:身份验证" style="text;html=1;strokeColor=none;fillColor=#dae8fc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="65" width="730" height="30" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="p1" value="用户点击「忘记密码」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="115" width="300" height="50" as="geometry" />
</mxCell>
<!-- Show form -->
<mxCell id="p2" value="展示「找回密码」页面Stepper
步骤一:用户名 + 绑定邮箱输入框" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="200" width="400" height="60" as="geometry" />
</mxCell>
<!-- User submits -->
<mxCell id="p3" value="用户输入用户名 + 邮箱,点击「下一步」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="300" width="400" height="50" as="geometry" />
</mxCell>
<!-- Backend verification -->
<mxCell id="p4" value="服务端校验用户名与邮箱是否匹配" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="390" width="400" height="50" as="geometry" />
</mxCell>
<!-- Unified response -->
<mxCell id="p5" value="统一响应前端:
「如信息匹配,重置链接将发送至您的邮箱」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="480" width="400" height="60" as="geometry" />
</mxCell>
<!-- Decision: Match? -->
<mxCell id="p6" value="用户名与邮箱匹配?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="395" width="220" height="70" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="p7" value="同一账号 1 小时内已发 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="490" width="220" height="70" as="geometry" />
</mxCell>
<!-- Matched: generate token -->
<mxCell id="p8" value="生成加密 Token
secrets.token_urlsafe(32),有效期 30 分钟)
异步发送重置邮件" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="590" width="240" height="70" as="geometry" />
</mxCell>
<!-- No match: silent -->
<mxCell id="p9" value="不匹配:静默处理
(不发邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="405" width="180" height="60" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="p10" value="已超频率上限
静默处理" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="505" width="160" height="50" as="geometry" />
</mxCell>
<!-- ===== STEP 2 Header ===== -->
<mxCell id="step2hdr" value="步骤二:用户点击邮件重置链接" style="text;html=1;strokeColor=none;fillColor=#d5e8d4;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="690" width="730" height="30" as="geometry" />
</mxCell>
<!-- User clicks link -->
<mxCell id="p11" value="用户点击邮件中的重置链接" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="740" width="300" height="50" as="geometry" />
</mxCell>
<!-- Validate token -->
<mxCell id="p12" value="服务端校验 Token 有效性
is_used=False AND expires_at 未过期)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="830" width="350" height="60" as="geometry" />
</mxCell>
<!-- Token decision -->
<mxCell id="p13" value="Token 有效?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="300" y="930" width="250" height="70" as="geometry" />
</mxCell>
<!-- Invalid token -->
<mxCell id="p14" value="提示「链接已过期或已使用,请重新申请」
提供「重新申请」按钮(跳回步骤一)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="940" width="260" height="60" as="geometry" />
</mxCell>
<!-- ===== STEP 3 Header ===== -->
<mxCell id="step3hdr" value="步骤三:输入并提交新密码" style="text;html=1;strokeColor=none;fillColor=#fff2cc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="1030" width="730" height="30" as="geometry" />
</mxCell>
<!-- Show reset form -->
<mxCell id="p15" value="展示「重置密码」表单
(新密码 + 确认新密码 + 密码强度指示)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="1080" width="350" height="60" as="geometry" />
</mxCell>
<!-- User submits new password -->
<mxCell id="p16" value="用户输入新密码并提交" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1180" width="300" height="50" as="geometry" />
</mxCell>
<!-- Complexity check -->
<mxCell id="p17" value="密码复杂度校验
≥8位含字母+数字,两次一致)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1265" width="300" height="80" as="geometry" />
</mxCell>
<!-- Complexity fail -->
<mxCell id="p18" value="实时提示不满足的规则
(逐条红色 ✗ / 绿色 ✓ 视觉指引)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1275" width="240" height="60" as="geometry" />
</mxCell>
<!-- History check -->
<mxCell id="p19" value="历史密码校验
(不得与最近 3 次历史密码相同)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1380" width="300" height="80" as="geometry" />
</mxCell>
<!-- History fail -->
<mxCell id="p20" value="提示「不得与最近 3 次密码相同」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1395" width="240" height="50" as="geometry" />
</mxCell>
<!-- Success: update password -->
<mxCell id="p21" value="✅ 校验通过:
① 更新密码PBKDF2+SHA256 哈希存储)
② is_initial_password = False
③ 清除该账号所有有效 Session
④ 标记 Token 为 is_used = True" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="1500" width="400" height="100" as="geometry" />
</mxCell>
<!-- End -->
<mxCell id="p22" value="跳转登录界面
提示「密码已重置,请使用新密码登录」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1630" width="300" height="60" as="geometry" />
</mxCell>
<!-- Edges Step 1 -->
<mxCell id="ep1" edge="1" source="p1" target="p2" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep2" edge="1" source="p2" target="p3" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep3" edge="1" source="p3" target="p4" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep4" edge="1" source="p4" target="p5" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep5" edge="1" source="p4" target="p6" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="625" y="415" /><mxPoint x="650" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep6" value="否" edge="1" source="p6" target="p9" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep7" value="是" edge="1" source="p6" target="p7" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep8" value="是(超限)" edge="1" source="p7" target="p10" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="525" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep9" value="否(未超限)" edge="1" source="p7" target="p8" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 2 edges -->
<mxCell id="ep10" edge="1" source="p5" target="p11" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep11" edge="1" source="p11" target="p12" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep12" edge="1" source="p12" target="p13" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep13" value="否(无效/过期)" edge="1" source="p13" target="p14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="965" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep14" value="重新申请" edge="1" source="p14" target="p2" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="960" y="970" /><mxPoint x="960" y="230" /><mxPoint x="625" y="230" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep15" value="是(有效)" edge="1" source="p13" target="p15" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 3 edges -->
<mxCell id="ep16" edge="1" source="p15" target="p16" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep17" edge="1" source="p16" target="p17" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep18" value="不通过" edge="1" source="p17" target="p18" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1305" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep19" value="" edge="1" source="p18" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep20" value="通过" edge="1" source="p17" target="p19" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep21" value="不通过" edge="1" source="p19" target="p20" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1420" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep22" value="" edge="1" source="p20" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep23" value="通过" edge="1" source="p19" target="p21" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep24" edge="1" source="p21" target="p22" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
</root>
</mxGraphModel>
</diagram>
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-04-25T00:00:00.000Z" agent="OpenCode" version="21.0.0">
<!-- ============================================================
5.4.1 找回用户名流程
============================================================ -->
<diagram id="recover-username" name="5.4.1 找回用户名流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="t1" value="5.4.1 找回用户名流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="u1" value="用户点击「忘记用户名」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="80" width="300" height="50" as="geometry" />
</mxCell>
<!-- Decision: Is email format valid? -->
<mxCell id="u2" value="展示「找回用户名」页面
(邮箱输入框 + 发送按钮)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="170" width="350" height="50" as="geometry" />
</mxCell>
<!-- User inputs email -->
<mxCell id="u3" value="用户输入邮箱并点击「发送」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="260" width="350" height="50" as="geometry" />
</mxCell>
<!-- Decision: Email format valid? -->
<mxCell id="u4" value="邮箱格式校验通过?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="350" width="300" height="70" as="geometry" />
</mxCell>
<!-- Format invalid -->
<mxCell id="u5" value="提示「请输入有效的邮箱地址」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="360" width="220" height="50" as="geometry" />
</mxCell>
<!-- Backend query -->
<mxCell id="u6" value="服务端查询邮箱是否绑定账号
(不向前端返回查询结果)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="470" width="350" height="60" as="geometry" />
</mxCell>
<!-- Unified response to frontend -->
<mxCell id="u7" value="统一响应前端:
「如该邮箱已绑定账号,您将收到邮件」
发送按钮进入 60 秒倒计时" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="580" width="350" height="70" as="geometry" />
</mxCell>
<!-- Decision: Email exists? -->
<mxCell id="u8" value="邮箱已绑定 Tenant Admin 账号?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="475" width="240" height="70" as="geometry" />
</mxCell>
<!-- Email found: send email -->
<mxCell id="u9" value="后台:异步发送邮件
(包含用户名、发送时间)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="580" width="220" height="60" as="geometry" />
</mxCell>
<!-- Email not found: silent -->
<mxCell id="u10" value="后台:静默处理
(不发送邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="660" width="220" height="50" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="u11" value="同一邮箱 1 小时内已发送 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="700" width="240" height="70" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="u12" value="拒绝发送
(达到频率上限)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="715" width="160" height="50" as="geometry" />
</mxCell>
<!-- User receives email -->
<mxCell id="u13" value="用户查收邮件,获取用户名" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="810" width="220" height="50" as="geometry" />
</mxCell>
<!-- Return to login -->
<mxCell id="u14" value="点击「返回登录」
回到登录界面" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="700" width="300" height="50" as="geometry" />
</mxCell>
<!-- Edges -->
<mxCell id="e1" edge="1" source="u1" target="u2" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e2" edge="1" source="u2" target="u3" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e3" edge="1" source="u3" target="u4" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e4" value="否" edge="1" source="u4" target="u5" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="385" /></Array></mxGeometry>
</mxCell>
<mxCell id="e5" value="" edge="1" source="u5" target="u3" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="730" y="285" /></Array></mxGeometry>
</mxCell>
<mxCell id="e6" value="是" edge="1" source="u4" target="u6" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e7" edge="1" source="u6" target="u7" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e8" edge="1" source="u6" target="u8" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="600" y="500" /><mxPoint x="630" y="510" /></Array></mxGeometry>
</mxCell>
<mxCell id="e9" value="是" edge="1" source="u8" target="u11" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e10" value="否(普通员工邮箱或不存在)" edge="1" source="u8" target="u10" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="660" as="targetPoint" /></mxGeometry>
</mxCell>
<mxCell id="e11" value="否(未超限)" edge="1" source="u11" target="u9" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e12" value="是(超过 3 次)" edge="1" source="u11" target="u12" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="735" /></Array></mxGeometry>
</mxCell>
<mxCell id="e13" edge="1" source="u9" target="u13" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e14" edge="1" source="u13" target="u14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="750" y="835" /><mxPoint x="425" y="835" /><mxPoint x="425" y="750" /></Array></mxGeometry>
</mxCell>
<mxCell id="e15" edge="1" source="u7" target="u14" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<!-- ============================================================
5.4.2 找回密码流程
============================================================ -->
<diagram id="recover-password" name="5.4.2 找回密码流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1300" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="title" value="5.4.2 找回密码流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- ===== STEP 1 Header ===== -->
<mxCell id="step1hdr" value="步骤一:身份验证" style="text;html=1;strokeColor=none;fillColor=#dae8fc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="65" width="730" height="30" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="p1" value="用户点击「忘记密码」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="115" width="300" height="50" as="geometry" />
</mxCell>
<!-- Show form -->
<mxCell id="p2" value="展示「找回密码」页面Stepper
步骤一:用户名 + 绑定邮箱输入框" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="200" width="400" height="60" as="geometry" />
</mxCell>
<!-- User submits -->
<mxCell id="p3" value="用户输入用户名 + 邮箱,点击「下一步」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="300" width="400" height="50" as="geometry" />
</mxCell>
<!-- Backend verification -->
<mxCell id="p4" value="服务端校验用户名与邮箱是否匹配" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="390" width="400" height="50" as="geometry" />
</mxCell>
<!-- Unified response -->
<mxCell id="p5" value="统一响应前端:
「如信息匹配,重置链接将发送至您的邮箱」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="480" width="400" height="60" as="geometry" />
</mxCell>
<!-- Decision: Match? -->
<mxCell id="p6" value="用户名与邮箱匹配?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="395" width="220" height="70" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="p7" value="同一账号 1 小时内已发 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="490" width="220" height="70" as="geometry" />
</mxCell>
<!-- Matched: generate token -->
<mxCell id="p8" value="生成加密 Token
secrets.token_urlsafe(32),有效期 30 分钟)
异步发送重置邮件" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="590" width="240" height="70" as="geometry" />
</mxCell>
<!-- No match: silent -->
<mxCell id="p9" value="不匹配:静默处理
(不发邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="405" width="180" height="60" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="p10" value="已超频率上限
静默处理" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="505" width="160" height="50" as="geometry" />
</mxCell>
<!-- ===== STEP 2 Header ===== -->
<mxCell id="step2hdr" value="步骤二:用户点击邮件重置链接" style="text;html=1;strokeColor=none;fillColor=#d5e8d4;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="690" width="730" height="30" as="geometry" />
</mxCell>
<!-- User clicks link -->
<mxCell id="p11" value="用户点击邮件中的重置链接" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="740" width="300" height="50" as="geometry" />
</mxCell>
<!-- Validate token -->
<mxCell id="p12" value="服务端校验 Token 有效性
is_used=False AND expires_at 未过期)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="830" width="350" height="60" as="geometry" />
</mxCell>
<!-- Token decision -->
<mxCell id="p13" value="Token 有效?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="300" y="930" width="250" height="70" as="geometry" />
</mxCell>
<!-- Invalid token -->
<mxCell id="p14" value="提示「链接已过期或已使用,请重新申请」
提供「重新申请」按钮(跳回步骤一)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="940" width="260" height="60" as="geometry" />
</mxCell>
<!-- ===== STEP 3 Header ===== -->
<mxCell id="step3hdr" value="步骤三:输入并提交新密码" style="text;html=1;strokeColor=none;fillColor=#fff2cc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="1030" width="730" height="30" as="geometry" />
</mxCell>
<!-- Show reset form -->
<mxCell id="p15" value="展示「重置密码」表单
(新密码 + 确认新密码 + 密码强度指示)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="1080" width="350" height="60" as="geometry" />
</mxCell>
<!-- User submits new password -->
<mxCell id="p16" value="用户输入新密码并提交" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1180" width="300" height="50" as="geometry" />
</mxCell>
<!-- Complexity check -->
<mxCell id="p17" value="密码复杂度校验
≥8位含字母+数字,两次一致)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1265" width="300" height="80" as="geometry" />
</mxCell>
<!-- Complexity fail -->
<mxCell id="p18" value="实时提示不满足的规则
(逐条红色 ✗ / 绿色 ✓ 视觉指引)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1275" width="240" height="60" as="geometry" />
</mxCell>
<!-- History check -->
<mxCell id="p19" value="历史密码校验
(不得与最近 3 次历史密码相同)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1380" width="300" height="80" as="geometry" />
</mxCell>
<!-- History fail -->
<mxCell id="p20" value="提示「不得与最近 3 次密码相同」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1395" width="240" height="50" as="geometry" />
</mxCell>
<!-- Success: update password -->
<mxCell id="p21" value="✅ 校验通过:
① 更新密码PBKDF2+SHA256 哈希存储)
② is_initial_password = False
③ 清除该账号所有有效 Session
④ 标记 Token 为 is_used = True" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="1500" width="400" height="100" as="geometry" />
</mxCell>
<!-- End -->
<mxCell id="p22" value="跳转登录界面
提示「密码已重置,请使用新密码登录」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1630" width="300" height="60" as="geometry" />
</mxCell>
<!-- Edges Step 1 -->
<mxCell id="ep1" edge="1" source="p1" target="p2" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep2" edge="1" source="p2" target="p3" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep3" edge="1" source="p3" target="p4" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep4" edge="1" source="p4" target="p5" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep5" edge="1" source="p4" target="p6" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="625" y="415" /><mxPoint x="650" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep6" value="否" edge="1" source="p6" target="p9" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep7" value="是" edge="1" source="p6" target="p7" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep8" value="是(超限)" edge="1" source="p7" target="p10" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="525" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep9" value="否(未超限)" edge="1" source="p7" target="p8" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 2 edges -->
<mxCell id="ep10" edge="1" source="p5" target="p11" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep11" edge="1" source="p11" target="p12" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep12" edge="1" source="p12" target="p13" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep13" value="否(无效/过期)" edge="1" source="p13" target="p14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="965" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep14" value="重新申请" edge="1" source="p14" target="p2" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="960" y="970" /><mxPoint x="960" y="230" /><mxPoint x="625" y="230" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep15" value="是(有效)" edge="1" source="p13" target="p15" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 3 edges -->
<mxCell id="ep16" edge="1" source="p15" target="p16" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep17" edge="1" source="p16" target="p17" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep18" value="不通过" edge="1" source="p17" target="p18" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1305" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep19" value="" edge="1" source="p18" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep20" value="通过" edge="1" source="p17" target="p19" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep21" value="不通过" edge="1" source="p19" target="p20" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1420" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep22" value="" edge="1" source="p20" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep23" value="通过" edge="1" source="p19" target="p21" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep24" edge="1" source="p21" target="p22" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@@ -1,334 +1,334 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-04-25T00:00:00.000Z" agent="OpenCode" version="21.0.0">
<!-- ============================================================
5.4.1 找回用户名流程
============================================================ -->
<diagram id="recover-username" name="5.4.1 找回用户名流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="t1" value="5.4.1 找回用户名流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="u1" value="用户点击「忘记用户名」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="80" width="300" height="50" as="geometry" />
</mxCell>
<!-- Decision: Is email format valid? -->
<mxCell id="u2" value="展示「找回用户名」页面&#xa;(邮箱输入框 + 发送按钮)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="170" width="350" height="50" as="geometry" />
</mxCell>
<!-- User inputs email -->
<mxCell id="u3" value="用户输入邮箱并点击「发送」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="260" width="350" height="50" as="geometry" />
</mxCell>
<!-- Decision: Email format valid? -->
<mxCell id="u4" value="邮箱格式校验通过?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="350" width="300" height="70" as="geometry" />
</mxCell>
<!-- Format invalid -->
<mxCell id="u5" value="提示「请输入有效的邮箱地址」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="360" width="220" height="50" as="geometry" />
</mxCell>
<!-- Backend query -->
<mxCell id="u6" value="服务端查询邮箱是否绑定账号&#xa;(不向前端返回查询结果)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="470" width="350" height="60" as="geometry" />
</mxCell>
<!-- Unified response to frontend -->
<mxCell id="u7" value="统一响应前端:&#xa;「如该邮箱已绑定账号,您将收到邮件」&#xa;发送按钮进入 60 秒倒计时" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="580" width="350" height="70" as="geometry" />
</mxCell>
<!-- Decision: Email exists? -->
<mxCell id="u8" value="邮箱已绑定 Tenant Admin 账号?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="475" width="240" height="70" as="geometry" />
</mxCell>
<!-- Email found: send email -->
<mxCell id="u9" value="后台:异步发送邮件&#xa;(包含用户名、发送时间)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="580" width="220" height="60" as="geometry" />
</mxCell>
<!-- Email not found: silent -->
<mxCell id="u10" value="后台:静默处理&#xa;(不发送邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="660" width="220" height="50" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="u11" value="同一邮箱 1 小时内已发送 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="700" width="240" height="70" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="u12" value="拒绝发送&#xa;(达到频率上限)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="715" width="160" height="50" as="geometry" />
</mxCell>
<!-- User receives email -->
<mxCell id="u13" value="用户查收邮件,获取用户名" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="810" width="220" height="50" as="geometry" />
</mxCell>
<!-- Return to login -->
<mxCell id="u14" value="点击「返回登录」&#xa;回到登录界面" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="700" width="300" height="50" as="geometry" />
</mxCell>
<!-- Edges -->
<mxCell id="e1" edge="1" source="u1" target="u2" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e2" edge="1" source="u2" target="u3" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e3" edge="1" source="u3" target="u4" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e4" value="否" edge="1" source="u4" target="u5" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="385" /></Array></mxGeometry>
</mxCell>
<mxCell id="e5" value="" edge="1" source="u5" target="u3" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="730" y="285" /></Array></mxGeometry>
</mxCell>
<mxCell id="e6" value="是" edge="1" source="u4" target="u6" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e7" edge="1" source="u6" target="u7" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e8" edge="1" source="u6" target="u8" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="600" y="500" /><mxPoint x="630" y="510" /></Array></mxGeometry>
</mxCell>
<mxCell id="e9" value="是" edge="1" source="u8" target="u11" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e10" value="否(普通员工邮箱或不存在)" edge="1" source="u8" target="u10" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="660" as="targetPoint" /></mxGeometry>
</mxCell>
<mxCell id="e11" value="否(未超限)" edge="1" source="u11" target="u9" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e12" value="是(超过 3 次)" edge="1" source="u11" target="u12" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="735" /></Array></mxGeometry>
</mxCell>
<mxCell id="e13" edge="1" source="u9" target="u13" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e14" edge="1" source="u13" target="u14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="750" y="835" /><mxPoint x="425" y="835" /><mxPoint x="425" y="750" /></Array></mxGeometry>
</mxCell>
<mxCell id="e15" edge="1" source="u7" target="u14" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<!-- ============================================================
5.4.2 找回密码流程
============================================================ -->
<diagram id="recover-password" name="5.4.2 找回密码流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1300" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="title" value="5.4.2 找回密码流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- ===== STEP 1 Header ===== -->
<mxCell id="step1hdr" value="步骤一:身份验证" style="text;html=1;strokeColor=none;fillColor=#dae8fc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="65" width="730" height="30" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="p1" value="用户点击「忘记密码」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="115" width="300" height="50" as="geometry" />
</mxCell>
<!-- Show form -->
<mxCell id="p2" value="展示「找回密码」页面Stepper&#xa;步骤一:用户名 + 绑定邮箱输入框" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="200" width="400" height="60" as="geometry" />
</mxCell>
<!-- User submits -->
<mxCell id="p3" value="用户输入用户名 + 邮箱,点击「下一步」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="300" width="400" height="50" as="geometry" />
</mxCell>
<!-- Backend verification -->
<mxCell id="p4" value="服务端校验用户名与邮箱是否匹配" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="390" width="400" height="50" as="geometry" />
</mxCell>
<!-- Unified response -->
<mxCell id="p5" value="统一响应前端:&#xa;「如信息匹配,重置链接将发送至您的邮箱」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="480" width="400" height="60" as="geometry" />
</mxCell>
<!-- Decision: Match? -->
<mxCell id="p6" value="用户名与邮箱匹配?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="395" width="220" height="70" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="p7" value="同一账号 1 小时内已发 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="490" width="220" height="70" as="geometry" />
</mxCell>
<!-- Matched: generate token -->
<mxCell id="p8" value="生成加密 Token&#xa;secrets.token_urlsafe(32),有效期 30 分钟)&#xa;异步发送重置邮件" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="590" width="240" height="70" as="geometry" />
</mxCell>
<!-- No match: silent -->
<mxCell id="p9" value="不匹配:静默处理&#xa;(不发邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="405" width="180" height="60" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="p10" value="已超频率上限&#xa;静默处理" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="505" width="160" height="50" as="geometry" />
</mxCell>
<!-- ===== STEP 2 Header ===== -->
<mxCell id="step2hdr" value="步骤二:用户点击邮件重置链接" style="text;html=1;strokeColor=none;fillColor=#d5e8d4;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="690" width="730" height="30" as="geometry" />
</mxCell>
<!-- User clicks link -->
<mxCell id="p11" value="用户点击邮件中的重置链接" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="740" width="300" height="50" as="geometry" />
</mxCell>
<!-- Validate token -->
<mxCell id="p12" value="服务端校验 Token 有效性&#xa;is_used=False AND expires_at 未过期)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="830" width="350" height="60" as="geometry" />
</mxCell>
<!-- Token decision -->
<mxCell id="p13" value="Token 有效?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="300" y="930" width="250" height="70" as="geometry" />
</mxCell>
<!-- Invalid token -->
<mxCell id="p14" value="提示「链接已过期或已使用,请重新申请」&#xa;提供「重新申请」按钮(跳回步骤一)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="940" width="260" height="60" as="geometry" />
</mxCell>
<!-- ===== STEP 3 Header ===== -->
<mxCell id="step3hdr" value="步骤三:输入并提交新密码" style="text;html=1;strokeColor=none;fillColor=#fff2cc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="1030" width="730" height="30" as="geometry" />
</mxCell>
<!-- Show reset form -->
<mxCell id="p15" value="展示「重置密码」表单&#xa;(新密码 + 确认新密码 + 密码强度指示)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="1080" width="350" height="60" as="geometry" />
</mxCell>
<!-- User submits new password -->
<mxCell id="p16" value="用户输入新密码并提交" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1180" width="300" height="50" as="geometry" />
</mxCell>
<!-- Complexity check -->
<mxCell id="p17" value="密码复杂度校验&#xa;≥8位含字母+数字,两次一致)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1265" width="300" height="80" as="geometry" />
</mxCell>
<!-- Complexity fail -->
<mxCell id="p18" value="实时提示不满足的规则&#xa;(逐条红色 ✗ / 绿色 ✓ 视觉指引)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1275" width="240" height="60" as="geometry" />
</mxCell>
<!-- History check -->
<mxCell id="p19" value="历史密码校验&#xa;(不得与最近 3 次历史密码相同)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1380" width="300" height="80" as="geometry" />
</mxCell>
<!-- History fail -->
<mxCell id="p20" value="提示「不得与最近 3 次密码相同」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1395" width="240" height="50" as="geometry" />
</mxCell>
<!-- Success: update password -->
<mxCell id="p21" value="✅ 校验通过:&#xa;① 更新密码PBKDF2+SHA256 哈希存储)&#xa;② is_initial_password = False&#xa;③ 清除该账号所有有效 Session&#xa;④ 标记 Token 为 is_used = True" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="1500" width="400" height="100" as="geometry" />
</mxCell>
<!-- End -->
<mxCell id="p22" value="跳转登录界面&#xa;提示「密码已重置,请使用新密码登录」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1630" width="300" height="60" as="geometry" />
</mxCell>
<!-- Edges Step 1 -->
<mxCell id="ep1" edge="1" source="p1" target="p2" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep2" edge="1" source="p2" target="p3" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep3" edge="1" source="p3" target="p4" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep4" edge="1" source="p4" target="p5" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep5" edge="1" source="p4" target="p6" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="625" y="415" /><mxPoint x="650" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep6" value="否" edge="1" source="p6" target="p9" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep7" value="是" edge="1" source="p6" target="p7" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep8" value="是(超限)" edge="1" source="p7" target="p10" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="525" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep9" value="否(未超限)" edge="1" source="p7" target="p8" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 2 edges -->
<mxCell id="ep10" edge="1" source="p5" target="p11" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep11" edge="1" source="p11" target="p12" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep12" edge="1" source="p12" target="p13" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep13" value="否(无效/过期)" edge="1" source="p13" target="p14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="965" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep14" value="重新申请" edge="1" source="p14" target="p2" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="960" y="970" /><mxPoint x="960" y="230" /><mxPoint x="625" y="230" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep15" value="是(有效)" edge="1" source="p13" target="p15" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 3 edges -->
<mxCell id="ep16" edge="1" source="p15" target="p16" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep17" edge="1" source="p16" target="p17" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep18" value="不通过" edge="1" source="p17" target="p18" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1305" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep19" value="" edge="1" source="p18" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep20" value="通过" edge="1" source="p17" target="p19" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep21" value="不通过" edge="1" source="p19" target="p20" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1420" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep22" value="" edge="1" source="p20" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep23" value="通过" edge="1" source="p19" target="p21" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep24" edge="1" source="p21" target="p22" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-04-25T00:00:00.000Z" agent="OpenCode" version="21.0.0">
<!-- ============================================================
5.4.1 找回用户名流程
============================================================ -->
<diagram id="recover-username" name="5.4.1 找回用户名流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="t1" value="5.4.1 找回用户名流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="u1" value="用户点击「忘记用户名」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="80" width="300" height="50" as="geometry" />
</mxCell>
<!-- Decision: Is email format valid? -->
<mxCell id="u2" value="展示「找回用户名」页面&#xa;(邮箱输入框 + 发送按钮)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="170" width="350" height="50" as="geometry" />
</mxCell>
<!-- User inputs email -->
<mxCell id="u3" value="用户输入邮箱并点击「发送」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="260" width="350" height="50" as="geometry" />
</mxCell>
<!-- Decision: Email format valid? -->
<mxCell id="u4" value="邮箱格式校验通过?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="350" width="300" height="70" as="geometry" />
</mxCell>
<!-- Format invalid -->
<mxCell id="u5" value="提示「请输入有效的邮箱地址」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="360" width="220" height="50" as="geometry" />
</mxCell>
<!-- Backend query -->
<mxCell id="u6" value="服务端查询邮箱是否绑定账号&#xa;(不向前端返回查询结果)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="470" width="350" height="60" as="geometry" />
</mxCell>
<!-- Unified response to frontend -->
<mxCell id="u7" value="统一响应前端:&#xa;「如该邮箱已绑定账号,您将收到邮件」&#xa;发送按钮进入 60 秒倒计时" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="580" width="350" height="70" as="geometry" />
</mxCell>
<!-- Decision: Email exists? -->
<mxCell id="u8" value="邮箱已绑定 Tenant Admin 账号?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="475" width="240" height="70" as="geometry" />
</mxCell>
<!-- Email found: send email -->
<mxCell id="u9" value="后台:异步发送邮件&#xa;(包含用户名、发送时间)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="580" width="220" height="60" as="geometry" />
</mxCell>
<!-- Email not found: silent -->
<mxCell id="u10" value="后台:静默处理&#xa;(不发送邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="660" width="220" height="50" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="u11" value="同一邮箱 1 小时内已发送 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="630" y="700" width="240" height="70" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="u12" value="拒绝发送&#xa;(达到频率上限)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="715" width="160" height="50" as="geometry" />
</mxCell>
<!-- User receives email -->
<mxCell id="u13" value="用户查收邮件,获取用户名" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="810" width="220" height="50" as="geometry" />
</mxCell>
<!-- Return to login -->
<mxCell id="u14" value="点击「返回登录」&#xa;回到登录界面" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="700" width="300" height="50" as="geometry" />
</mxCell>
<!-- Edges -->
<mxCell id="e1" edge="1" source="u1" target="u2" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e2" edge="1" source="u2" target="u3" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e3" edge="1" source="u3" target="u4" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e4" value="否" edge="1" source="u4" target="u5" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="385" /></Array></mxGeometry>
</mxCell>
<mxCell id="e5" value="" edge="1" source="u5" target="u3" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="730" y="285" /></Array></mxGeometry>
</mxCell>
<mxCell id="e6" value="是" edge="1" source="u4" target="u6" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e7" edge="1" source="u6" target="u7" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e8" edge="1" source="u6" target="u8" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="600" y="500" /><mxPoint x="630" y="510" /></Array></mxGeometry>
</mxCell>
<mxCell id="e9" value="是" edge="1" source="u8" target="u11" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e10" value="否(普通员工邮箱或不存在)" edge="1" source="u8" target="u10" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="660" as="targetPoint" /></mxGeometry>
</mxCell>
<mxCell id="e11" value="否(未超限)" edge="1" source="u11" target="u9" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e12" value="是(超过 3 次)" edge="1" source="u11" target="u12" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="735" /></Array></mxGeometry>
</mxCell>
<mxCell id="e13" edge="1" source="u9" target="u13" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e14" edge="1" source="u13" target="u14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="750" y="835" /><mxPoint x="425" y="835" /><mxPoint x="425" y="750" /></Array></mxGeometry>
</mxCell>
<mxCell id="e15" edge="1" source="u7" target="u14" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<!-- ============================================================
5.4.2 找回密码流程
============================================================ -->
<diagram id="recover-password" name="5.4.2 找回密码流程">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1"
pageWidth="850" pageHeight="1300" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="title" value="5.4.2 找回密码流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="175" y="20" width="500" height="40" as="geometry" />
</mxCell>
<!-- ===== STEP 1 Header ===== -->
<mxCell id="step1hdr" value="步骤一:身份验证" style="text;html=1;strokeColor=none;fillColor=#dae8fc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="65" width="730" height="30" as="geometry" />
</mxCell>
<!-- Start -->
<mxCell id="p1" value="用户点击「忘记密码」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="115" width="300" height="50" as="geometry" />
</mxCell>
<!-- Show form -->
<mxCell id="p2" value="展示「找回密码」页面Stepper&#xa;步骤一:用户名 + 绑定邮箱输入框" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="200" width="400" height="60" as="geometry" />
</mxCell>
<!-- User submits -->
<mxCell id="p3" value="用户输入用户名 + 邮箱,点击「下一步」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="300" width="400" height="50" as="geometry" />
</mxCell>
<!-- Backend verification -->
<mxCell id="p4" value="服务端校验用户名与邮箱是否匹配" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="390" width="400" height="50" as="geometry" />
</mxCell>
<!-- Unified response -->
<mxCell id="p5" value="统一响应前端:&#xa;「如信息匹配,重置链接将发送至您的邮箱」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="480" width="400" height="60" as="geometry" />
</mxCell>
<!-- Decision: Match? -->
<mxCell id="p6" value="用户名与邮箱匹配?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="395" width="220" height="70" as="geometry" />
</mxCell>
<!-- Rate limit check -->
<mxCell id="p7" value="同一账号 1 小时内已发 ≥ 3 次?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="490" width="220" height="70" as="geometry" />
</mxCell>
<!-- Matched: generate token -->
<mxCell id="p8" value="生成加密 Token&#xa;secrets.token_urlsafe(32),有效期 30 分钟)&#xa;异步发送重置邮件" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="650" y="590" width="240" height="70" as="geometry" />
</mxCell>
<!-- No match: silent -->
<mxCell id="p9" value="不匹配:静默处理&#xa;(不发邮件,不报错)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="405" width="180" height="60" as="geometry" />
</mxCell>
<!-- Rate limit exceeded -->
<mxCell id="p10" value="已超频率上限&#xa;静默处理" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="900" y="505" width="160" height="50" as="geometry" />
</mxCell>
<!-- ===== STEP 2 Header ===== -->
<mxCell id="step2hdr" value="步骤二:用户点击邮件重置链接" style="text;html=1;strokeColor=none;fillColor=#d5e8d4;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="690" width="730" height="30" as="geometry" />
</mxCell>
<!-- User clicks link -->
<mxCell id="p11" value="用户点击邮件中的重置链接" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="740" width="300" height="50" as="geometry" />
</mxCell>
<!-- Validate token -->
<mxCell id="p12" value="服务端校验 Token 有效性&#xa;is_used=False AND expires_at 未过期)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="830" width="350" height="60" as="geometry" />
</mxCell>
<!-- Token decision -->
<mxCell id="p13" value="Token 有效?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="300" y="930" width="250" height="70" as="geometry" />
</mxCell>
<!-- Invalid token -->
<mxCell id="p14" value="提示「链接已过期或已使用,请重新申请」&#xa;提供「重新申请」按钮(跳回步骤一)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="620" y="940" width="260" height="60" as="geometry" />
</mxCell>
<!-- ===== STEP 3 Header ===== -->
<mxCell id="step3hdr" value="步骤三:输入并提交新密码" style="text;html=1;strokeColor=none;fillColor=#fff2cc;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=1;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="1030" width="730" height="30" as="geometry" />
</mxCell>
<!-- Show reset form -->
<mxCell id="p15" value="展示「重置密码」表单&#xa;(新密码 + 确认新密码 + 密码强度指示)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="1080" width="350" height="60" as="geometry" />
</mxCell>
<!-- User submits new password -->
<mxCell id="p16" value="用户输入新密码并提交" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1180" width="300" height="50" as="geometry" />
</mxCell>
<!-- Complexity check -->
<mxCell id="p17" value="密码复杂度校验&#xa;≥8位含字母+数字,两次一致)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1265" width="300" height="80" as="geometry" />
</mxCell>
<!-- Complexity fail -->
<mxCell id="p18" value="实时提示不满足的规则&#xa;(逐条红色 ✗ / 绿色 ✓ 视觉指引)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1275" width="240" height="60" as="geometry" />
</mxCell>
<!-- History check -->
<mxCell id="p19" value="历史密码校验&#xa;(不得与最近 3 次历史密码相同)" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1380" width="300" height="80" as="geometry" />
</mxCell>
<!-- History fail -->
<mxCell id="p20" value="提示「不得与最近 3 次密码相同」" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="640" y="1395" width="240" height="50" as="geometry" />
</mxCell>
<!-- Success: update password -->
<mxCell id="p21" value="✅ 校验通过:&#xa;① 更新密码PBKDF2+SHA256 哈希存储)&#xa;② is_initial_password = False&#xa;③ 清除该账号所有有效 Session&#xa;④ 标记 Token 为 is_used = True" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="225" y="1500" width="400" height="100" as="geometry" />
</mxCell>
<!-- End -->
<mxCell id="p22" value="跳转登录界面&#xa;提示「密码已重置,请使用新密码登录」" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="275" y="1630" width="300" height="60" as="geometry" />
</mxCell>
<!-- Edges Step 1 -->
<mxCell id="ep1" edge="1" source="p1" target="p2" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep2" edge="1" source="p2" target="p3" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep3" edge="1" source="p3" target="p4" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep4" edge="1" source="p4" target="p5" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep5" edge="1" source="p4" target="p6" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="625" y="415" /><mxPoint x="650" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep6" value="否" edge="1" source="p6" target="p9" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="430" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep7" value="是" edge="1" source="p6" target="p7" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep8" value="是(超限)" edge="1" source="p7" target="p10" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="900" y="525" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep9" value="否(未超限)" edge="1" source="p7" target="p8" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 2 edges -->
<mxCell id="ep10" edge="1" source="p5" target="p11" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep11" edge="1" source="p11" target="p12" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep12" edge="1" source="p12" target="p13" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep13" value="否(无效/过期)" edge="1" source="p13" target="p14" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="620" y="965" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep14" value="重新申请" edge="1" source="p14" target="p2" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="960" y="970" /><mxPoint x="960" y="230" /><mxPoint x="625" y="230" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep15" value="是(有效)" edge="1" source="p13" target="p15" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<!-- Step 3 edges -->
<mxCell id="ep16" edge="1" source="p15" target="p16" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep17" edge="1" source="p16" target="p17" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep18" value="不通过" edge="1" source="p17" target="p18" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1305" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep19" value="" edge="1" source="p18" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep20" value="通过" edge="1" source="p17" target="p19" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep21" value="不通过" edge="1" source="p19" target="p20" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="640" y="1420" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep22" value="" edge="1" source="p20" target="p16" parent="1">
<mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="760" y="1205" /></Array></mxGeometry>
</mxCell>
<mxCell id="ep23" value="通过" edge="1" source="p19" target="p21" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
<mxCell id="ep24" edge="1" source="p21" target="p22" parent="1"><mxGeometry relative="1" as="geometry" /></mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

File diff suppressed because it is too large Load Diff