Files
cloud d5d381759e 功能: 完善风电功率方案计算
- 新增计算方案保存与方案二筛选参数
- 支持方案二桨角规则和有效数据导出
- 优化功率曲线绘制和设计功率展示
2026-07-17 16:01:58 +08:00

70 lines
2.2 KiB
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.
# wind_power_cal
风电功率计算平台 — 前后端工程。
技术栈与 `edge_collector` 对齐:
- **后端**C++17 + [Drogon](https://github.com/drogonframework/drogon) HTTP 框架(从源码编译,见 `third_party/drogon_repo`
- **前端**React 19 + Vite 8 + react-router 7
## 目录结构
```
wind_power_cal/
├── third_party/
│ ├── ensure_third_party.sh # Drogon/Trantor 源码编译脚本(幂等)
│ ├── drogon_repo/ # Drogon + Trantor 源码(vendored
│ ├── nlohmann/ # json 头文件库(header-only
│ └── drogon/install/<arch>/ # 编译产物(gitignored
├── backend/ # C++ Drogon 服务(可执行 wind_server
│ ├── CMakeLists.txt
│ ├── config/server_config.json
│ └── src/ # main.cpp + controllers/ + utils/
└── frontend/web_app/ # React + Vite 前端
```
## 快速开始
### 1. 一键启动(默认监听 :8080)
```bash
./run.sh
```
根目录 `run.sh` 会依次:源码编译 Drogon(首次较慢,约数分钟;之后幂等跳过)→ 构建后端 → 构建前端 → 整理 `runtime/wind_power/` → 启动服务。
验证:
```bash
curl -s localhost:8080/api/system/health
# {"data":{"status":"ok"},"msg":"success","status":0}
curl -s localhost:8080/api/system/version
# {"data":{"name":"wind_power_cal","version":"0.1.0"},"msg":"success","status":0}
```
### 2. 前端开发模式(默认监听 :5173)
```bash
cd frontend/web_app
npm install
npm run dev
```
打开 http://localhost:5173 ,首页通过 Vite 代理 (`/api``localhost:8080`) 访问后端接口。
### 3. 生产联调
统一使用根目录 `./run.sh`。脚本会构建前端并把 `dist/` 同步到 `runtime/wind_power/web/`,由后端托管 SPA;访问 http://localhost:8080/ 直接返回前端页面。
## 端口
| 服务 | 端口 |
| ------ | ----- |
| 后端 | 8080 |
| 前端 dev | 5173 |
## 说明
- MVP 阶段不包含数据库 / MQTT / 鉴权;目录结构已就位,可参照 `edge_collector` 后续扩展。
- 响应统一信封:`{"status":0,"msg":"success","data":{...}}`(见 `backend/src/utils/ResponseUtil.h`)。