Loading...
Loading...
Compare original and translation side by side
┌─────────────────────────────────────────────────────────────┐
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ UI 层 │───▶│ 前端服务 │───▶│ 前端 API │ │
│ │(Vue3) │ │(Pinia) │ │(Axios) │ │
│ └──────────┘ └──────────┘ └────┬─────┘ │
│ HTTP Request │
│ ▼ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 数据层 │◀───│ 后端服务 │◀───│ 后端 API │ │
│ │(SQLAlch) │ │(Service) │ │(FastAPI) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────┐
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ UI 层 │───▶│ 前端服务 │───▶│ 前端 API │ │
│ │(Vue3) │ │(Pinia) │ │(Axios) │ │
│ └──────────┘ └──────────┘ └────┬─────┘ │
│ HTTP Request │
│ ▼ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 数据层 │◀───│ 后端服务 │◀───│ 后端 API │ │
│ │(SQLAlch) │ │(Service) │ │(FastAPI) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────┘| 用户描述关键词 | 识别为入口层 | 示例 |
|---|---|---|
| "界面显示..."、"页面上..." | UI 层 | "用户详情页要显示注册时间" |
| "Store里..."、"状态管理..." | 前端服务层 | "登录状态需要在刷新后保持" |
| "前端调用..."、"API接口..." | 前端 API 层 | "前端需要调用获取订单列表接口" |
| "后端接口..."、"API返回..." | 后端 API 层 | "用户列表接口需要支持分页" |
| "业务逻辑..."、"数据处理..." | 后端服务层 | "订单创建时要检查库存" |
| "数据库..."、"表结构..."、"字段..." | 数据层 | "用户表需要添加手机号字段" |
| User Description Keywords | Identified as Entry Layer | Example |
|---|---|---|
| "UI display...", "page..." | UI Layer | "User detail page needs to display registration time" |
| "Store...", "state management..." | Frontend Service Layer | "Login state needs to persist after refresh" |
| "Frontend call...", "API interface..." | Frontend API Layer | "Frontend needs to call the order list interface" |
| "Backend interface...", "API returns..." | Backend API Layer | "User list interface needs to support pagination" |
| "Business logic...", "data processing..." | Backend Service Layer | "Check inventory when creating an order" |
| "Database...", "table structure...", "field..." | Data Layer | "User table needs to add a phone number field" |
| 入口层 | 向前推导(→ UI) | 向后推导(→ DB) |
|---|---|---|
| UI 层 | 无 | UI → 前端服务 → 前端API → 后端API → 后端服务 → 数据层 |
| 前端服务层 | ← UI | → 前端API → 后端API → 后端服务 → 数据层 |
| 前端 API 层 | ← 前端服务 ← UI | → 后端API → 后端服务 → 数据层 |
| 后端 API 层 | ← 前端API ← 前端服务 ← UI | → 后端服务 → 数据层 |
| 后端服务层 | ← 后端API ← 前端API ← 前端服务 ← UI | → 数据层 |
| 数据层 | ← 后端服务 ← 后端API ← 前端API ← 前端服务 ← UI | 无 |
| Entry Layer | Forward Deduction (→ UI) | Backward Deduction (→ DB) |
|---|---|---|
| UI Layer | None | UI → Frontend Service → Frontend API → Backend API → Backend Service → Data Layer |
| Frontend Service Layer | ← UI | → Frontend API → Backend API → Backend Service → Data Layer |
| Frontend API Layer | ← Frontend Service ← UI | → Backend API → Backend Service → Data Layer |
| Backend API Layer | ← Frontend API ← Frontend Service ← UI | → Backend Service → Data Layer |
| Backend Service Layer | ← Backend API ← Frontend API ← Frontend Service ← UI | → Data Layer |
| Data Layer | ← Backend Service ← Backend API ← Frontend API ← Frontend Service ← UI | None |
| 层级 | 命名风格 | 示例 |
|---|---|---|
| UI 层 / 前端服务层 | 驼峰命名 | |
| 前端 API 层 / 后端层 / 数据层 | 蛇形命名 | |
| TypeScript | Pydantic | SQLAlchemy |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| Layer | Naming Convention | Example |
|---|---|---|
| UI Layer / Frontend Service Layer | camelCase | |
| Frontend API Layer / Backend Layers / Data Layer | snake_case | |
| TypeScript | Pydantic | SQLAlchemy |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
undefinedundefinedalembic revision --autogenerate -m "描述"undefinedalembic revision --autogenerate -m "description"undefined| 资源 | 路径 | 用途 |
|---|---|---|
| 贯穿式修改工作流 | references/cross_layer_workflow.md | 详细的跨层修改流程和示例 |
| 架构层说明 | references/architecture_layers.md | 六层架构详细职责与约束 |
| 代码模式 | references/code_patterns.md | 常见代码模式、类型同步 |
| 安全检查清单 | references/security_checklist.md | 安全审查要点 |
| 代码模板 | assets/templates/ | 各层代码模板文件 |
| Resource | Path | Purpose |
|---|---|---|
| Cross-layer Modification Workflow | references/cross_layer_workflow.md | Detailed cross-layer modification workflow and examples |
| Architecture Layer Description | references/architecture_layers.md | Detailed responsibilities and constraints of six-layer architecture |
| Code Patterns | references/code_patterns.md | Common code patterns, type synchronization |
| Security Checklist | references/security_checklist.md | Security review key points |
| Code Templates | assets/templates/ | Code template files for each layer |
registration_timeregistration_timeregistrationTimeregistration_timeregistration_timeregistrationTimephone_numberphone_numberGET /ordersstatusstatusgetOrders()statusstatusGET /ordersstatusstatusgetOrders()