|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.reghao.tnb.content.app.vod.service.rcmd.task;
|
|
|
|
|
|
+import cn.reghao.tnb.content.api.constant.PostScope;
|
|
|
import cn.reghao.tnb.content.api.constant.RcmdMode;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoCard;
|
|
|
import cn.reghao.tnb.content.app.util.redis.ds.RedisList;
|
|
|
@@ -51,21 +52,11 @@ public class RcmdTask implements Runnable {
|
|
|
List<Integer> userScopes = contentPermission.getUserScopes(loginUser);
|
|
|
long start = System.currentTimeMillis();
|
|
|
try {
|
|
|
- if (mode == RcmdMode.USER.getValue()) {
|
|
|
- } else if (mode == RcmdMode.VIP.getValue()) {
|
|
|
- } else {
|
|
|
+ if (mode == RcmdMode.VIP.getValue()) {
|
|
|
+ userScopes.clear();
|
|
|
+ userScopes.add(PostScope.PROTECT.getCode());
|
|
|
}
|
|
|
|
|
|
- Set<String> interestTagIds = userInterestBased.getUserInterestCategory(loginUser);
|
|
|
- if (interestTagIds.size() < 1000) {
|
|
|
- List<String> tagIds = videoPostQuery.getRandomTags(100);
|
|
|
- for (String tagId : tagIds) {
|
|
|
- userInterestBased.addUserInterests(loginUser, tagId);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Set<String> interestItems = userInterestBased.getUserInterestItems(loginUser);
|
|
|
- List<String> videoIds1 = new ArrayList<>(interestItems);
|
|
|
List<String> videoIds = videoPostQuery.getRandomVideoIds(userScopes, size);
|
|
|
if (!videoIds.isEmpty()) {
|
|
|
List<VideoCard> videoCards = videoPostQuery.getVideoCards(videoIds);
|
|
|
@@ -79,4 +70,18 @@ public class RcmdTask implements Runnable {
|
|
|
|
|
|
log.info("{}'s rcmd-task cost {}s", loginUser, (System.currentTimeMillis()-start)/1000);
|
|
|
}
|
|
|
+
|
|
|
+ List<String> getRedisVideoIds(long loginUser) {
|
|
|
+ Set<String> interestTagIds = userInterestBased.getUserInterestCategory(loginUser);
|
|
|
+ if (interestTagIds.size() < 1000) {
|
|
|
+ List<String> tagIds = videoPostQuery.getRandomTags(100);
|
|
|
+ for (String tagId : tagIds) {
|
|
|
+ userInterestBased.addUserInterests(loginUser, tagId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> interestItems = userInterestBased.getUserInterestItems(loginUser);
|
|
|
+ List<String> videoIds1 = new ArrayList<>(interestItems);
|
|
|
+ return videoIds1;
|
|
|
+ }
|
|
|
}
|