| | |
| | | page.getRecords().forEach(v -> { |
| | | v.setTagList(tagMap.get(v.getId())); |
| | | v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverUrl())); |
| | | v.getGoodsList().forEach(goods ->{ |
| | | if (StringUtils.isNotBlank(goods.getThumbnail())&&!goods.getThumbnail().contains("http")) { |
| | | goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail())); |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | |
| | | case "recommend":// 加载推荐视频 |
| | | baseMapper.recommendVideo(page, query); |
| | | //推荐视频重新排序 |
| | | WxVideoVO wxVideoVO = null; |
| | | if (StringUtils.isNotBlank(query.getVideoId())) { |
| | | wxVideoVO = baseMapper.recommendVideoByVideoId(query); |
| | | } |
| | | List<WxVideoVO> records = page.getRecords(); |
| | | Collections.shuffle(records); |
| | | if (wxVideoVO!=null) { |
| | | records.set(0, wxVideoVO); |
| | | } |
| | | break; |
| | | case "author": // 加载视频主页我发布的视频 |
| | | AuthorVideoQuery query1 = new AuthorVideoQuery(); |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getCommentNum(String videoId, Integer mysqlNum) { |
| | | public Integer getCommentNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_COMMENT_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getCollectNum(String videoId, Integer mysqlNum) { |
| | | public Integer getCollectNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_COLLECT_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getThumbsUpNum(String videoId, Integer mysqlNum) { |
| | | public Integer getThumbsUpNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_THUMBS_UP_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |