This commit is contained in:
Leo
2026-02-04 16:54:00 +08:00
parent 79eb651e12
commit f178bf0ab4
2 changed files with 80 additions and 30 deletions
+7 -7
View File
@@ -52,14 +52,14 @@ curl -s -X GET "http://localhost:30313/jarvis/wps365/files?userId=default_user&p
- `msg` 为「用户未授权」则需先完成 WPS365 授权;
- 其他错误可根据 `msg` 或后端日志排查。
## 后端实际请求的 WPS API
## 后端实际请求的 WPS API(已按官方文档调整)
- **URL**:`{apiBaseUrl}/yundoc/files`,例如 `https://openapi.wps.cn/api/v1/yundoc/files`
- **方法**:GET
- **Query**:`page`、`page_size`(由后端把 `page` 和 `pageSize` 映射过去)
- **鉴权**:Header 中带 WPS365 的 `access_token`
若 WPS 侧返回 404 或参数错误,需对照 [WPS 开放平台-云文档 API](https://open.wps.cn/documents/app-integration-dev/wps365/server/yundoc/introduce.html) 确认路径、参数名(如是否需 `drive_id`、`parent_id` 等)是否与当前实现一致,必要时调整 `WPS365ApiServiceImpl.getFileList` 中的 URL 与参数。
- **官方结构**:云文档文件在「驱动盘」下,路径为 `GET https://openapi.wps.cn/v7/drives/{drive_id}/files`(参见 [云文档业务域概述](https://open.wps.cn/documents/app-integration-dev/wps365/server/yundoc/introduce.html))。
- **当前实现**:
1. 先请求 `GET https://openapi.wps.cn/v7/drives` 获取驱动盘列表,取第一个或 `allotee_type=user` 的 `drive_id`;
2. 若无则尝试 `GET https://openapi.wps.cn/v7/drives/me`;
3. 再请求 `GET https://openapi.wps.cn/v7/drives/{drive_id}/files?page=1&page_size=20`。
- **鉴权**:Header 中带 WPS365 的 `access_token`(Bearer)。若接口要求 KSO-1 签名,需按官方文档在请求头中增加签名后再试。
## 成功后的下一步