Files
HAOVP/backend/API_TEST_REPORT.md

228 lines
10 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.
# Backend API Test Report
更新时间:2026-04-18
## 说明
- 本轮基于单机 Docker Compose 环境验收。
- Apifox 项目当前约 186 条 endpoint,含重复文档项、内部接口和管理接口映射。
- 为避免长脚本挂死,本轮改成按模块分批验收。
- 详细结果以 JSON 明细为准:
- [API_TEST_RESULTS_auth_user.json](/C:/Users/toyas/Desktop/本科毕业设计/参考/workspace/HA-OVP/backend/API_TEST_RESULTS_auth_user.json)
- [API_TEST_RESULTS_content_comment_recommend.json](/C:/Users/toyas/Desktop/本科毕业设计/参考/workspace/HA-OVP/backend/API_TEST_RESULTS_content_comment_recommend.json)
- [API_TEST_RESULTS_admin.json](/C:/Users/toyas/Desktop/本科毕业设计/参考/workspace/HA-OVP/backend/API_TEST_RESULTS_admin.json)
## 汇总
- `auth + user`:29 项,`29` 通过,`0` 失败
- `content + comment + recommend`:63 项,`63` 通过,`0` 失败
- `admin`:23 项,`23` 通过,`0` 失败,`0` 未测
## 最新重测
- 运行态排查确认:
- `video-user`、`video-comment` 容器此前实际运行的是旧 JAR,和本地源码不一致
- 重新构建并覆盖容器内 `/app/app.jar` 后,`video-user`、`video-content`、`video-comment` 已与本地源码对齐
- 公开接口放行修复已生效:
- `GET /user/profile/public/{userId}` 现为 `200`
- `GET /user/profile/search` 现为 `200`
- `GET /user/follow/following/{userId}` 现为 `200`
- `GET /user/follow/followers/{userId}` 现为 `200`
- `GET /content/category/tree` 现为 `200`
- `GET /content/tag/list` 现为 `200`
- `GET /content/tag/page` 现为 `200`
- `POST /content/video` 已打通,最新实测返回 `200`,成功创建视频 `id=17`
- 评论链有进展:
- `GET /comment/public/list?videoId=17...` 返回 `200`
- 评论已成功落库到 `videoId=17`
- `POST /comment` 已恢复为正常快速返回,最新实测 `200`,耗时约 `1207ms`
- `POST /comment/reply` 已返回 `200`
- `POST /comment/like/{id}` 已返回 `200`
- `GET /comment/reply/public/list/{commentId}` 已返回 `200`
- 评论交互短测已补齐:
- `POST /comment`:`200`,约 `279ms`
- `POST /comment/like/{id}`:`200`,约 `294ms`
- `DELETE /comment/like/{id}`:`200`,约 `291ms`
- `POST /comment/reply`:`200`,约 `281ms`
- `GET /comment/reply/public/list/{commentId}`:`200`,约 `264ms`
- `GET /comment/reply/public/hot/{commentId}`:`200`,约 `258ms`
- `POST /comment/reply/like/{id}`:`200`,约 `262ms`
- `DELETE /comment/reply/like/{id}`:`200`,约 `263ms`
- `DELETE /comment/reply/{id}`:`200`,约 `284ms`
- `DELETE /comment/{id}`:`200`,约 `263ms`
- 评论详情/置顶链复测:
- `GET /comment/public/detail/{id}`:`200`,约 `718ms`
- `POST /comment/top/{id}?videoId=17`:`200`,约 `426ms`
- `DELETE /comment/top/{id}?videoId=17`:`200`,约 `333ms`
- `top/untop` 需要“视频作者身份 + 正确的 videoId 参数”;旧失败结论来自测试前提不成立
- 服务端已补充校验:评论必须属于传入的 `videoId`
- 视频主链短测已补齐:
- `GET /content/video/public/17`:`200`,约 `281ms`
- `GET /content/video/17`:`200`,约 `312ms`
- `PUT /content/video`:`200`,约 `370ms`
- `GET /content/tag/video/17`:`200`,约 `248ms`
- `POST /content/video/like/17`:`200`,约 `325ms`
- `DELETE /content/video/like/17`:`200`,约 `303ms`
- `POST /content/video/coin/17?amount=1`:`200`,约 `262ms`
- `POST /content/video/share/17?platform=wechat`:`200`,约 `275ms`
- `POST /content/video/play`:`200`,约 `295ms`
- `POST /content/video/favorite`:`200`,约 `345ms`
- `DELETE /content/video/favorite/17`:`200`,约 `270ms`
- `GET /content/video/user/30`:作者登录视角已恢复可见审核中视频
- `POST /content/video/favorite` 的慢失败根因是收藏数同步回写 `video-user` 时遇到锁等待,现已改为 `afterCommit + async best-effort`
- 内容链残余现象:
- 视频详情/视频列表里的 `userNickname`、`userAvatar` 为空问题已修复
- 根因是 `video-content` 前台详情/列表里对 Feign 返回码使用了 `Integer == Integer` 比较,远程 `200` 没命中成功分支
- 弹幕和统计链已打通:
- `POST /content/danmaku`:`200`,约 `411ms`
- `GET /content/danmaku/all/17`:`200`,约 `270ms`
- `GET /content/danmaku/time?videoId=17&startTime=0&endTime=30`:`200`,约 `263ms`
- `GET /content/stat/daily/17?...`:`200`,约 `254ms`
- `GET /content/stat/play/trend/17?...`:`200`,约 `245ms`
- `GET /content/stat/interaction/17`:`200`,约 `251ms`
- RocketMQ 路由当前仍异常,但 `video-content` 已补全主表降级更新;弹幕发送后 `danmakuCount` 已能从 `0` 正常变为 `1`
- 后台视频审核链已打通:
- `POST /admin/platform/content/video/review/17?status=1&reason=ok`:`200`
- `GET /admin/platform/content/video/17`:`200`
- 根因一:`video-admin -> video-content` 之前没有透传 `adminId`
- 根因二:`content_video_review.reviewer_id` 外键错误指向了 `video_auth.auth_user`
- 现已改为透传 `X-Admin-Id`,并把审核记录外键改到 `video_admin.admin_user`
- 最后一轮收尾项:
- `GET /auth/username/30`:`200`,已作为公开接口放行
- `GET /admin/platform/comment/10`:`200`
- `PUT /admin/platform/content/video/disable/17`:`200`
- 为避免环境被留在下架状态,`videoId=17` 已重新审核恢复为发布状态
- 原未测接口空白已补齐:
- `POST /admin/auth/logout`:`200`
- `GET /auth/admin/login/stats`:`200`
- `PUT /auth/admin/reset-password/{userId}`:`200`
- `PUT /auth/admin/lock/{userId}/{locked}`:`200`
- `POST /content/video/upload`:`200`
- `DELETE /content/video/{id}`:`200`
- `POST /content/video/review/{videoId}`:内部审核接口已打通,普通用户访问已 `403`
- `GET /content/category/admin/list`:`200`
- `POST /content/category/admin`:`200`
- `PUT /content/category/admin`:`200`
- `DELETE /content/category/admin/{categoryId}`:`200`
- `DELETE /content/tag/{id}`:`200`
- `POST /recommend/behavior`:`200`
- `POST /recommend/interest/update`:`200`
- `GET /recommend/similar/{videoId}`:`200`
- `GET /recommend/tag/{tagId}`:`200`
- `recommend/interest/update` 的 500 根因是 MyBatis `Map<Long, Float>` foreach 写法错误,现已修复
- 登录链复测:
- `POST /auth/login` 最新实测 `200`,耗时约 `994ms`
## 已通过
### 核心认证与用户链
- `POST /auth/register`
- `POST /auth/login`
- `POST /auth/login`:不带验证码会被拦截
- `POST /auth/refresh`
- `GET /auth/username/{userId}`
- `GET /auth/current`
- `GET /user/profile/current`
- `PUT /user/profile`
- `GET /user/setting`
- `PUT /user/setting`
- `POST /user/follow/{followId}`
- `GET /user/follow/check/{followId}`
- `GET /user/notification/list`
- `GET /user/notification/unread/count`
- `PUT /user/notification/read`
- `POST /user/message`
- `GET /user/message/list`
- `GET /user/message/detail/{targetId}`
- `GET /user/message/unread/count`
- `PUT /user/message/read/{senderId}`
- `POST /auth/logout`
- `DELETE /user/follow/{followId}`
- `GET /auth/admin/login/stats`
- `PUT /auth/admin/reset-password/{userId}`
- `PUT /auth/admin/lock/{userId}/{locked}`
### 内容/评论/推荐中已确认正常的部分
- `GET /content/category/list`
- `GET /content/category/tree`
- `POST /content/category`
- `PUT /content/category`
- `DELETE /content/category/{id}`
- `POST /content/tag`
- `GET /content/tag/list`
- `GET /content/tag/page`
- `POST /content/favorite`
- `GET /content/favorite/list`
- `PUT /content/favorite`
- `POST /content/video`
- `POST /content/video/upload`
- `GET /content/video/public/{id}`
- `GET /content/video/public/list`
- `GET /content/video/{id}`
- `GET /content/video/list`
- `GET /content/video/user/{userId}`
- `PUT /content/video`
- `DELETE /content/video/{id}`
- `POST /content/video/review/{videoId}`
- `GET /content/tag/video/{videoId}`
- `POST /content/video/like/{videoId}`
- `DELETE /content/video/like/{videoId}`
- `POST /content/video/coin/{videoId}`
- `POST /content/video/share/{videoId}`
- `POST /content/video/play`
- `POST /content/video/favorite`
- `GET /content/favorite/{favoriteId}/videos`
- `DELETE /content/video/favorite/{videoId}`
- `DELETE /content/favorite/{id}`
- `GET /content/category/admin/list`
- `POST /content/category/admin`
- `PUT /content/category/admin`
- `DELETE /content/category/admin/{categoryId}`
- `DELETE /content/tag/{id}`
- `POST /content/danmaku`
- `GET /content/danmaku/all/{videoId}`
- `GET /content/danmaku/time`
- `GET /content/stat/daily/{videoId}`
- `GET /content/stat/play/trend/{videoId}`
- `GET /content/stat/interaction/{videoId}`
- `POST /recommend/behavior`
- `POST /recommend/interest/update`
- `GET /recommend/similar/{videoId}`
- `GET /recommend/tag/{tagId}`
- `GET /comment/public/list`
- `GET /comment/public/detail/{id}`
- `GET /comment/public/stat/{videoId}`
- `POST /comment`
- `DELETE /comment/{id}`
- `POST /comment/reply`
- `POST /comment/like/{id}`
- `DELETE /comment/like/{id}`
- `POST /comment/top/{id}`
- `DELETE /comment/top/{id}`
- `GET /comment/reply/public/list/{commentId}`
- `GET /comment/reply/public/hot/{commentId}`
- `POST /comment/reply/like/{id}`
- `DELETE /comment/reply/like/{id}`
- `DELETE /comment/reply/{id}`
### 后台链
- `POST /admin/auth/login`
- `POST /admin/auth/login`:不带验证码会被拦截
- `POST /admin/auth/logout`
- `GET /admin/auth/info`
- `GET /admin/platform/user/list`
- `GET /admin/platform/user/{userId}`
- `PUT /admin/platform/user/{userId}/status/{status}`
- `PUT /admin/platform/user/{userId}/reset-password`
- `POST /auth/login`:禁用用户后登录被拦截
- `POST /auth/login`:后台重置密码后可重新登录
- `GET /admin/platform/content/category/list`
- `POST /admin/platform/content/category`
- `PUT /admin/platform/content/category`
- `DELETE /admin/platform/content/category/{categoryId}`
- `GET /admin/platform/comment/list`
- `GET /admin/platform/comment/stats`
- `GET /admin/platform/comment/{commentId}`
- `GET /admin/platform/content/video/list`
- `GET /admin/platform/content/video/{videoId}`
- `POST /admin/platform/content/video/review/{videoId}`
- `PUT /admin/platform/content/video/disable/{videoId}`
- `GET /admin/dashboard/stats`