| | |
| | | package cn.lili.modules.lmk.service.impl; |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import cn.lili.common.security.context.UserContext; |
| | | import cn.lili.modules.lmk.domain.entity.VideoAuditRecord; |
| | | import cn.lili.modules.lmk.domain.entity.VideoTag; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result recommendVideo(AbsQuery query) { |
| | | public Result recommendVideo(VideoQuery query) { |
| | | // 推荐算法: 1. 根据用户的收藏视频的标签 2. 根据用户关注的作者的其它视频 3. 根据用户的观看记录(观看时长较长的、重复观看次数较多的) 4. 基于相似用户的观看行为来给该用户推荐 |
| | | IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class); |
| | | baseMapper.recommendVideo(page); |
| | | switch (query.getVideoFrom()) { |
| | | case "recommend": |
| | | baseMapper.recommendVideo(page); |
| | | break; |
| | | case "author": |
| | | AuthorVideoQuery query1 = new AuthorVideoQuery(); |
| | | query1.setAuthorId(query.getAuthorId()); |
| | | baseMapper.getAuthorVideoPage(page, query1); |
| | | break; |
| | | case "collect": |
| | | AuthorVideoQuery query2 = new AuthorVideoQuery(); |
| | | query2.setAuthorId(query.getAuthorId()); |
| | | baseMapper.getAuthorVideoPage(page, query2); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (page.getTotal() > 0) { |
| | | List<String> videoIds = page.getRecords().stream().map(WxVideoVO::getId).collect(Collectors.toList()); |
| | | Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds(videoIds) |