feat(channel-service): add Python FastAPI pywechat channel service

- Add FastAPI project under channel-service/
- Implement mock pywechat client adapter (login, send, heartbeat)
- Add /v1/wechat-personal/login/*, /v1/wechat-personal/send/* APIs
- Add /v1/heartbeat and /v1/monitor/status for client health
- Add /monitor HTML page with Web Components
- Add pytest suite and Dockerfile
- Update .gitignore for Python/Node artifacts
This commit is contained in:
2026-07-07 12:36:54 +08:00
parent df2d253c7b
commit bd0ac464cf
19 changed files with 575 additions and 0 deletions

35
channel-service/README.md Normal file
View File

@@ -0,0 +1,35 @@
# sino-mci-channel-service
Python 渠道服务,用于管理 pywechat 个人微信等渠道客户端。
## 当前状态
- 使用 **Mock pywechat 客户端**进行开发联调;真实 Windows 环境需接入 `pywechat`/`pywinauto` 驱动微信 PC 客户端。
- 提供登录二维码模拟、消息发送模拟、心跳上报、客户端监控页面。
## 本地运行
```bash
cd channel-service
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload
```
## 测试
```bash
pytest
```
## 接口
- `GET /health` 健康检查
- `POST /v1/wechat-personal/login/start` 开始登录
- `GET /v1/wechat-personal/login/{account_id}/status` 查询登录状态
- `POST /v1/wechat-personal/login/{account_id}/confirm` 模拟扫码确认
- `POST /v1/wechat-personal/send/text` 发送文本消息
- `POST /v1/heartbeat` 客户端心跳
- `GET /v1/monitor/status` 查询所有客户端状态
- `GET /monitor` 客户端监控页面