45 lines
1.2 KiB
Markdown
45 lines
1.2 KiB
Markdown
# 脚本目录
|
|
|
|
## 文件说明
|
|
|
|
### test_api_sync.py
|
|
主要的API数据同步测试脚本。
|
|
|
|
**功能:**
|
|
- 从远程API获取所有GET/LIST接口数据
|
|
- 自动分页获取全量数据
|
|
- 保存为JSONL格式到 `remote_datasource` 目录
|
|
- 支持单项目模式或全量同步
|
|
|
|
**运行方式:**
|
|
```bash
|
|
python scripts/test_api_sync.py
|
|
```
|
|
|
|
**数据类型覆盖:**
|
|
- 基础数据: company, user, supplier, project
|
|
- 项目数据: contract, construction_task, material, contract_settlement, personnel
|
|
- 项目扩展: preparation, production, lar, units (从all_info获取)
|
|
- 明细数据: construction_task_detail, material_detail, contract_settlement_detail, personnel_detail
|
|
|
|
**配置说明:**
|
|
在文件中修改以下配置:
|
|
```python
|
|
BASE_URL = "http://localhost:8000/api/third/v2"
|
|
UID = "your-uid"
|
|
SECRET_KEY = "your-secret-key"
|
|
TARGET_PROJECT_ID = "xxx-xxx-xxx" # 单项目模式,设为None则全量同步
|
|
```
|
|
|
|
## 输出结果
|
|
|
|
数据保存在 `remote_datasource/datasource/` 目录下:
|
|
- `company_1.jsonl` - 公司数据
|
|
- `user_1.jsonl` - 用户数据
|
|
- `project_1.jsonl` - 项目数据
|
|
- ... 其他数据类型
|
|
|
|
## 更多文档
|
|
|
|
详细文档请查看项目根目录的 [API_SYNC_GUIDE.md](../API_SYNC_GUIDE.md)
|