初始化

This commit is contained in:
2026-04-02 23:40:04 +08:00
commit 381ea7085d
107 changed files with 11858 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# 架构规则
## 后端架构
### 分层架构
- **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 拦截器处理认证和错误