Files
2026-04-02 23:40:04 +08:00

41 lines
1020 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 架构规则
## 后端架构
### 分层架构
- **API 层**:仅处理请求/响应,调用 Service
- **Service 层**:业务逻辑,不直接操作数据库
- **Model 层**SQLAlchemy 模型定义
### 目录结构
```
app/
├── api/v1/ # API 路由
├── services/ # 业务逻辑
├── models/ # 数据模型
├── schemas/ # Pydantic 模式
├── core/ # 核心配置
├── tasks/ # Celery 任务
└── utils/ # 工具函数
```
### 异步任务
- 耗时操作使用 Celery
- SSH 状态检查使用异步任务
- 批量导入使用后台任务
## 前端架构
### 组件分类
- `components/common/`:通用组件(Layout、Table、Form
- `components/business/`:业务组件(Device、User
- `views/`:页面组件
### 状态管理
- 使用 Pinia stores
- 按模块划分:auth、device、user、system
### API 调用
- 统一在 `api/` 目录封装
- 使用 Axios 拦截器处理认证和错误