|
@@ -2,8 +2,10 @@ package com.tzld.longarticle.recommend.server;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recall.RecallService;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.Score;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.ScoreParam;
|
|
|
+import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountRateStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.strategy.ViewMultiplierStrategy;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
@@ -17,6 +19,10 @@ public class ScoreStrategyTest {
|
|
|
|
|
|
@Resource
|
|
|
ViewMultiplierStrategy viewMultiplierStrategy;
|
|
|
+ @Resource
|
|
|
+ ViewCountRateStrategy viewCountRateStrategy;
|
|
|
+ @Resource
|
|
|
+ RecallService recallService;
|
|
|
|
|
|
@Test
|
|
|
public void viewMultiplierStrategy() {
|
|
@@ -33,4 +39,23 @@ public class ScoreStrategyTest {
|
|
|
System.out.println(JSONObject.toJSONString(result));
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void viewCountRateStrategy() {
|
|
|
+ ScoreParam param = new ScoreParam();
|
|
|
+ param.setGhId("gh_bff0bcb0694a");
|
|
|
+ param.setAccountName("喜乐生活派");
|
|
|
+ List<Content> contentList = new ArrayList<>();
|
|
|
+ Content content = new Content();
|
|
|
+ content.setId("12341234");
|
|
|
+ content.setTitle("炒瘦肉有人放淀粉,有人放蛋清,都错了,教你正确做法,嫩滑不柴");
|
|
|
+ content.setCrawlerChannelContentId("0065561559007185d167afdd61b9ac5a");
|
|
|
+ contentList.add(content);
|
|
|
+ param.setContents(contentList);
|
|
|
+ recallService.setTitleAvgViewCount(contentList, "gh_bff0bcb0694a");
|
|
|
+ System.out.println(JSONObject.toJSONString(param.getContents().get(0).getHisPublishArticleList()));
|
|
|
+ List<Score> result = viewCountRateStrategy.score(param);
|
|
|
+ System.out.println(JSONObject.toJSONString(result));
|
|
|
+ //hisArticleList = hisArticleList.stream().filter(o -> o.getUpdateTime() < 1729267200).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
}
|