1e194858457ed449205c01f1a087781006641d08
wind_power_cal
风电功率计算平台 — 前后端工程。
技术栈与 edge_collector 对齐:
- 后端:C++17 + 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)
./run.sh
根目录 run.sh 会依次:源码编译 Drogon(首次较慢,约数分钟;之后幂等跳过)→ 构建后端 → 构建前端 → 整理 runtime/wind_power/ → 启动服务。
验证:
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)
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)。
Description
Languages
JavaScript
51.3%
C++
36.5%
CSS
7.1%
Shell
3.9%
CMake
1.1%
Other
0.1%