fix(library): 优化观看历史标题加载

This commit is contained in:
Zhou Weidong committed 2026-10-22 12:42:58 +08:00
1 parent abfca7a3be
commit 78114fa46d
11 files changed
+135 -88

No files matched your search

@@ -20,3 +20,12 @@
- loadMore 与 refresh 通过请求代次隔离,旧响应不得覆盖新列表。
- 空页立即停止加载;`loaded >= total` 后不再请求。
- 不新增依赖、不提交现有 `pubspec.lock`,不启停服务、不操作真机。
## 2026-10-22 范围修订
- 分页协议和 Controller 分页状态保持不改。
- 观看历史优先使用后端 `dramaTitle/dramaCover/episodeNumber`,只有标题为空时才预取详情。
- 标题为空且详情也未返回标题时,用本地化“第 N 集”兜底。
- 有标题的条目点击播放时再按需加载详情,不在列表加载阶段产生 N+1。
- 使用当前真实后端校验第 1/2 页请求参数、total 与 list;若运行实例仍忽略分页,
只在 PROGRESS 记录证据,不做前端全量兜底。
+44 -2
View File
@@ -628,8 +628,7 @@ UTF-8 解码、3000 字符截断、非 JSON、二进制字节数、DioException
- 收藏页、观看历史页接入滚动触底加载、下拉刷新、通用分页 footer、总数展示。
- 观看卡片优先展示分页接口的 `dramaTitle/dramaCover/episodeNumber`;
标题为空时显示本地化“第 N 集”,封面缺失时显示占位图标。
- API 兼容滚动发布窗口:后端仍返回旧 List 时包装为 `PageResult(total=list.length)`;
服务端新 PageResult 正常解析。
- API 严格解析服务端 PageResult;旧 List 不做客户端全量包装,由后端部署新契约解决。
- MineLogic 改用分页首屏 `list`,不再调用旧 limit 接口。
### 门禁
@@ -656,3 +655,46 @@ $ flutter test --no-pub
观看标题/集号/封面展示及空标题兜底均通过;全量静态分析零告警,632 项测试全过。
未新增依赖、未启停服务、未操作真机;现有 `pubspec.lock` 改动未提交。
### 范围修订:观看标题优先与按需详情
- 分页协议、Repository 与 Controller 分页状态保持不变。
- `_hydrate` 只对 `dramaTitle` 为空的记录补拉详情;后端已有标题时不再请求详情。
- 有标题的记录点击播放时才调用 `detailForOpen` 按需加载详情,避免列表阶段 N+1。
- 标题仍为空时使用本地化“第 N 集”,封面缺失继续显示占位。
- 移除了旧 List 自动包装为 PageResult 的前端全量兜底,避免掩盖后端契约问题。
真实后端分页取证(仅测试账号写入,不启停服务):
```text
GET /app/watch/recent?pageIndex=1&pageSize=1
{"shape":"list","length":2,"dramaIds":["1","5"]}
GET /app/watch/recent?pageIndex=2&pageSize=1
{"shape":"list","length":2,"dramaIds":["1","5"]}
GET /app/favorites?pageIndex=1&pageSize=1
{"shape":"list","length":2,"dramaIds":["1","5"]}
GET /app/favorites?pageIndex=2&pageSize=1
{"shape":"list","length":2,"dramaIds":["1","5"]}
```
解读:当前 8081 运行实例仍是旧包,返回 List 且忽略 pageIndex/pageSize;第 1/2 页
均返回相同两条数据。客户端不做全量兜底;live smoke 检测到旧 List 后明确标记 skipped,
等待后端新包部署后再执行分页真实联调。
门禁:
```text
$ flutter test --no-pub test/integration/live_watch_flow_test.dart test/library/library_api_test.dart test/watch/watch_api_test.dart test/watch/watch_records_controller_test.dart test/watch/watch_records_page_test.dart
00:02 +22 ~1: All tests passed!
$ dart analyze lib test
Analyzing lib, test...
No issues found!
$ flutter test --no-pub
00:52 +630 ~1: All tests passed!
```
解读:有 dramaTitle 时不触发详情请求、点击时才加载详情、空标题兜底、
第 2 页追加去重和 hasMore 行为均通过;全量分析零告警,630 项通过、1 项旧服务
能力探测跳过。`pubspec.lock` 既有改动未提交。