Files
railway_cloud/README.md
2025-10-13 10:14:50 +08:00

75 lines
2.0 KiB
Markdown
Raw 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.
# 铁路项目管理系统
基于FastAPI、MySQL、SQLAlchemy的铁路项目管理系统。
## 功能特性
- **账号管理**: 账号的增删改查包含id、账号、密码、状态、是否更新、标段等字段
- **数据库管理**: 表数据导入导出、SQL执行、建表删表等数据库操作
- **定时任务**: 支持cron、间隔、指定时间的定时任务调度
## 技术栈
- FastAPI: Web框架
- SQLAlchemy: ORM框架
- MySQL: 数据库
- APScheduler: 定时任务调度
- Pandas: 数据处理
- Pydantic: 数据验证
1
## 项目结构
```
app/
├── api/ # API路由
├── core/ # 核心配置
├── models/ # 数据库模型
├── schemas/ # Pydantic模型
├── services/ # 业务逻辑层
└── utils/ # 工具类
```
## 安装运行
1. 安装依赖:
```bash
pip install -r requirements.txt
```
2. 配置环境变量:
复制 `.env.example``.env` 并修改配置
3. 运行应用:
```bash
python main.py
```
测试
## API文档
启动后访问 http://localhost:8000/docs 查看API文档
## 主要API端点
### 账号管理
- `POST /api/accounts/` - 创建账号
- `GET /api/accounts/` - 获取账号列表
- `GET /api/accounts/{id}` - 获取单个账号
- `PUT /api/accounts/{id}` - 更新账号
- `DELETE /api/accounts/{id}` - 删除账号
### 数据库管理
- `POST /api/database/execute` - 执行SQL
- `POST /api/database/table-data` - 获取表数据
- `POST /api/database/create-table` - 创建表
- `DELETE /api/database/drop-table/{name}` - 删除表
- `POST /api/database/import-data` - 导入数据
- `GET /api/database/tables` - 获取表列表
### 定时任务
- `POST /api/tasks/cron` - 添加cron任务
- `POST /api/tasks/interval` - 添加间隔任务
- `POST /api/tasks/date` - 添加定时任务
- `GET /api/tasks/` - 获取任务列表
- `DELETE /api/tasks/{id}` - 删除任务
- `PUT /api/tasks/{id}/pause` - 暂停任务
- `PUT /api/tasks/{id}/resume` - 恢复任务