feat(content): 列表卡片与后台返回收藏点赞评论数
This commit is contained in:
1 parent
f90336963b
commit
256821b824
13 files changed
+324
-50
No files matched your search
+40
-41
@@ -1,59 +1,58 @@
|
||||
# INBOX
|
||||
|
||||
## [已处理] K83-A 右侧互动栏改用参考图同款图标资源
|
||||
## [已处理] K84-A 列表卡片与后台补充收藏 / 点赞 / 评论数
|
||||
|
||||
### 背景
|
||||
|
||||
K82-A 用 Material 图标替换后,形状与参考图仍不一致(星形/气泡/心形/分享箭头细节不同),
|
||||
且 Material 字形自带内边距,视觉上比参考图小。
|
||||
右侧互动栏要显示收藏、评论、喜欢的数量,但首页 feed 等列表卡片拿不到这三个数。
|
||||
|
||||
已从产品提供的参考图中提取出四个图标(白色 + 透明通道,保留原始形状与相对大小),
|
||||
放在仓库 `assets/icon/rail/`:
|
||||
已确认:
|
||||
|
||||
- `rail_save.png`(收藏,实心星)
|
||||
- `rail_comment.png`(评论,带三个点的气泡)
|
||||
- `rail_like.png`(喜欢,实心心形)
|
||||
- `rail_share.png`(分享,弯向右的箭头)
|
||||
- 数据库 `drama` 表有 `favorite_count`、`like_count`(无 comment_count 列,评论数按
|
||||
`content_comment` 统计,见 `AppDramaDetailVO.commentCount`)
|
||||
- `AppDramaDetailVO` 已返回 `likeCount / favoriteCount / commentCount`
|
||||
- **`AppDramaCardVO`(列表卡片)只有 `viewCount`,缺这三个字段** → 客户端列表阶段拿不到
|
||||
- 后台 `DramaRespVO` 只有 `views`,也缺这三个数
|
||||
- 客户端 `Drama.fromJson` 已经解析 `likeCount / favoriteCount / commentCount`,**客户端无需改**
|
||||
|
||||
### 改动
|
||||
### 任务(FruitServer 仓库)
|
||||
|
||||
1. `pubspec.yaml`
|
||||
- `flutter.assets` 增加 `assets/icon/rail/`(目录)
|
||||
2. `lib/pages/player/widgets/interaction_rail.dart`
|
||||
- `InteractionRailItem` 的 `IconData icon / activeIcon` 改为 `String asset`
|
||||
(`selected` 只决定颜色,不再切换图标)
|
||||
- 渲染改为:
|
||||
```dart
|
||||
Image.asset(
|
||||
item.asset,
|
||||
width: _iconSize,
|
||||
height: _iconSize,
|
||||
fit: BoxFit.contain,
|
||||
color: item.selected ? AppColors.blue : Colors.white,
|
||||
colorBlendMode: BlendMode.srcIn,
|
||||
)
|
||||
```
|
||||
- `_iconSize`:`30` → `32`;`_buttonSize` 保持 `44`;`_itemGap`:`22` → `24`
|
||||
- 删除 K82-A 引入的 `mirrorIcon`(新资源本身已朝右)
|
||||
3. `lib/pages/player/widgets/home_feed_overlay.dart` 与 `player_overlay.dart`
|
||||
- 四项分别传:`assets/icon/rail/rail_save.png`、`rail_comment.png`、`rail_like.png`、`rail_share.png`
|
||||
4. 测试
|
||||
- 把 `find.byIcon(Icons.star_rounded / favorite_rounded / reply_rounded / ios_share_rounded …)` 类断言
|
||||
改为查找对应 `Image.asset`(或用 Key 定位后断言 `Image.image` 的 asset 名)
|
||||
- Key(`rail-save`、`rail-comments`、`rail-like`、`rail-share`、`player-rail-*`、计数 Key)保持不变
|
||||
1. `fruitshorts-app-api/.../vo/AppDramaCardVO.java`
|
||||
- 增加 `Long likeCount`、`Long favoriteCount`、`Long commentCount`
|
||||
2. `fruitshorts-app-api/.../service/AppCatalogService.java`
|
||||
- `cards()` 里一次性批量取评论数:`Map<Long, Long> commentCounts = commentService.countByDramas(ids)`
|
||||
- `toCard()` 填充:
|
||||
- `likeCount` ← `drama.getLikeCount()`
|
||||
- `favoriteCount` ← `drama.getFavoriteCount()`
|
||||
- `commentCount` ← `commentCounts.getOrDefault(drama.getId(), 0L)`
|
||||
- 不要逐条 `countByDrama`(避免 N+1)
|
||||
3. `fruitshorts-module-interaction/.../service/CommentService.java`
|
||||
- 新增 `Map<Long, Long> countByDramas(Collection<Long> dramaIds)`:
|
||||
`deleted = 0` 且 `drama_id in (...)`,按 `drama_id` 分组计数;空集合返回空 Map
|
||||
- 现有 `countByDrama(Long)` 可复用该方法的单元素结果或保持不动
|
||||
4. 后台管理端(注意模块依赖方向:`module-interaction` 依赖 `module-content`,不能反向依赖)
|
||||
- `fruitshorts-module-content/.../vo/DramaRespVO.java` 增加 `likeCount / favoriteCount / commentCount`
|
||||
- `DramaService`(module-content)只填充 `likeCount / favoriteCount`(取实体字段),
|
||||
`commentCount` 先留空
|
||||
- `fruitshorts-admin-api` 的 Drama 接口(`DramaController` 或 admin 侧小服务)在分页/详情返回前,
|
||||
用 `CommentService.countByDramas(ids)` 批量回填 `commentCount`
|
||||
(分页一次查询;详情单条)
|
||||
5. 测试
|
||||
- `AppCatalogControllerContractTest`:列表卡片接口增加 `likeCount / favoriteCount / commentCount` 断言
|
||||
- 后台分页/详情如有测试,补充三个字段断言
|
||||
- `CommentService.countByDramas` 补单测(空集合 / 多剧集分组)
|
||||
|
||||
### 验收
|
||||
|
||||
- 门禁:`dart analyze lib test` 零告警、`flutter test` 全过、`flutter build apk --debug` 成功。
|
||||
- 真机自查:首页 feed 与全屏播放页右侧四个图标与参考图形状一致,大小一致,无深色圆底。
|
||||
- 门禁:`mvn test` 全过。
|
||||
- 接口自测:`GET /app/home/feed`(或现有首页聚合接口)返回的每个卡片都带三个数字段。
|
||||
|
||||
### Git
|
||||
|
||||
- 从 `develop` 拉 `feat/rail-icon-assets`。
|
||||
- 提交:`feat(player): 互动栏改用参考图同款图标资源`,作者 `Zhou Weidong <502333560@qq.com>`。
|
||||
- `--no-ff` 合回 `develop` 并 push;`FruitServer/docs/plans/PROGRESS.md` 追加 K83-A 留痕。
|
||||
- 从 `develop` 拉 `feat/drama-card-counts`。
|
||||
- 提交:`feat(content): 列表卡片与后台返回收藏点赞评论数`,作者 `Zhou Weidong <502333560@qq.com>`。
|
||||
- `--no-ff` 合回 `develop` 并 push;`FruitServer/docs/plans/PROGRESS.md` 追加 K84-A 留痕。
|
||||
|
||||
### 约束
|
||||
|
||||
- 全程中文;禁止 `git add -A`;图标资源已放到 `assets/icon/rail/`,不要重新绘制或改动形状;
|
||||
不改互动逻辑与 Key;完成后停住等待验收。
|
||||
- 全程中文;禁止 `git add -A`;不改客户端代码、不改 specs 仓库;完成后停住等待验收。
|
||||
Reference in new issue
Block a user