# Swagger 模块 1~2 真实联调速查 ## 1-健康检查(不必重复联调) | 接口 | 测法 | |------|------| | `GET /api/health` | Execute,应 `status: ok`,`modules` 含 qiwei、staff | 自动化:`test_01_health.py`(`run_all` 已含)。 --- ## 2-企微(需 `.env` 的 QIWEI_TOKEN`、`QIWEI_GUID`) ### 已覆盖(`test_13`,可不再手点) | 接口 | 说明 | |------|------| | `GET /qiwei/staff/{guid}/status` | 在线状态 | | `POST /qiwei/staff/batch-status` | 批量状态 | | `POST /qiwei/sync` | 同步消息 | | `POST /qiwei/proxy` + getRoomList | 群分页(可为空) | ### 新增真实联调(`test_19`,用 `QIWEI_ROOM_IDS`) | 接口 | 说明 | |------|------| | `POST /qiwei/webhook` | 用真实 guid + roomId 登记 docid | | `GET /qiwei/messages` | 查已存消息 | | `GET /qiwei/room-docs` | 台账列表 / 按 roomId | | `GET /qiwei/room-doc-anomalies` | 异常列表 | | `PUT /qiwei/room-doc-anomalies/{roomId}/resolve` | 解决多表异常 | ### Swagger 手测 webhook 示例 `POST /api/qiwei/webhook`: ```json { "code": 0, "msg": "ok", "data": [ { "cmd": 15000, "guid": "你的QIWEI_GUID", "msgType": 13, "fromRoomId": "10865515454476837", "msgData": { "linkUrl": "https://doc.weixin.qq.com/txdoc/excel?docid=DOC_SWAGGER_test001", "title": "沟通记录" }, "timestamp": 1716200000 } ] } ``` 然后 `GET /api/qiwei/room-docs?roomId=10865515454476837`。 --- 一键跑企微真实联调: ```bash cd backend/tests_python python -m pytest -m qiwei_live -v ```