Commit a6d5c8d4 authored by 王亚雷's avatar 王亚雷

游客权限

parent 3314de2c
......@@ -505,19 +505,20 @@ public class ThemeManager {
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())) {
if (StringUtils.isEmpty(req.getUserId())) {
throw new BizException(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMsg());
}
// 根据关注列表查询,按时间倒序
List<String> fansList = followRelService.queryIdolsByFansId(req.getUserId());
themes = themeService.queryByUserIdsCreateDesc(fansList, pageStart, pageSize);
if (CollectionUtils.isEmpty(excludeIds) && !themes.isEmpty()) {
// 说明是从头开始刷,则直接把最新的lastId放到redis中,保留一个月
Long lastId = themes.stream().map(ThemeEntity::getId).max(Long::compareTo).get();
redisCache.put(CACHE_IDOL_THEME_LAST_ID + req.getUserId(), lastId, 60 * 60 * 24 * 7 * 4);
// 未登录情况下返回空数组
themes = Lists.newArrayListWithCapacity(0);
} else {
// 根据关注列表查询,按时间倒序
List<String> fansList = followRelService.queryIdolsByFansId(req.getUserId());
themes = themeService.queryByUserIdsCreateDesc(fansList, pageStart, pageSize);
if (CollectionUtils.isEmpty(excludeIds) && !themes.isEmpty()) {
// 说明是从头开始刷,则直接把最新的lastId放到redis中,保留一个月
Long lastId = themes.stream().map(ThemeEntity::getId).max(Long::compareTo).get();
redisCache.put(CACHE_IDOL_THEME_LAST_ID + req.getUserId(), lastId, 60 * 60 * 24 * 7 * 4);
// visitLogService.addPageView(userId, userId, VisitTypeEnum.FOLLOW_THEME_VIEW);
}
}
} else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) {
// 根据话题查询热门
if (StringUtils.isEmpty(req.getTopicId())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment