瀏覽代碼

add score

wangyunpeng 10 月之前
父節點
當前提交
1bf89e7761

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/DefaultRankStrategy.java

@@ -47,6 +47,7 @@ public class DefaultRankStrategy implements RankStrategy {
         List<RankItem> items = CommonCollectionUtils.toList(param.getContents(), c -> {
             RankItem item = new RankItem();
             item.setContent(c);
+            c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             return item;
 

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV2Strategy.java

@@ -12,7 +12,6 @@ import com.tzld.longarticle.recommend.server.service.score.ScoreService;
 import com.tzld.longarticle.recommend.server.service.score.strategy.SimilarityStrategy;
 import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountStrategy;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
-import com.tzld.longarticle.recommend.server.util.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +43,7 @@ public class RankV2Strategy implements RankStrategy {
         List<RankItem> items = CommonCollectionUtils.toList(param.getContents(), c -> {
             RankItem item = new RankItem();
             item.setContent(c);
+            c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             return item;
 

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV3Strategy.java

@@ -46,6 +46,7 @@ public class RankV3Strategy implements RankStrategy {
         List<RankItem> items = CommonCollectionUtils.toList(param.getContents(), c -> {
             RankItem item = new RankItem();
             item.setContent(c);
+            c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             String[] contentPools = accountContentPoolConfigService.getContentPools(param.getAccountName());
             double score;
@@ -64,6 +65,7 @@ public class RankV3Strategy implements RankStrategy {
                         + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
                         + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
             }
+            c.setScore(score);
             item.setScore(score);
             return item;
         });

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV4Strategy.java

@@ -46,6 +46,7 @@ public class RankV4Strategy implements RankStrategy {
         List<RankItem> items = CommonCollectionUtils.toList(param.getContents(), c -> {
             RankItem item = new RankItem();
             item.setContent(c);
+            c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             String[] contentPools = accountContentPoolConfigService.getContentPools(param.getAccountName());
             double score;
@@ -61,6 +62,7 @@ public class RankV4Strategy implements RankStrategy {
                         + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
                         + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
             }
+            c.setScore(score);
             item.setScore(score);
             return item;
         });