|
@@ -32,23 +32,52 @@ public class ViewCountRateStrategy implements ScoreStrategy {
|
|
|
if (!contentPools[i].equals(content.getContentPoolType())) {
|
|
|
continue;
|
|
|
}
|
|
|
- double firstAvgViewCount = accountIndexAvgViewCountService.getAvgReadCount(param.getGhId(), i + 1);
|
|
|
+ double avgViewCountPos = accountIndexAvgViewCountService.getAvgReadCount(param.getGhId(), i + 1);
|
|
|
+ double avgViewCountFirst = accountIndexAvgViewCountService.getAvgReadCount(param.getGhId(), 1);
|
|
|
+ double avgViewCountSecond = accountIndexAvgViewCountService.getAvgReadCount(param.getGhId(), 2);
|
|
|
double showViewCountSum = 0D;
|
|
|
double avgViewCountSum = 0D;
|
|
|
+ double showViewCountSumFirst = 0D;
|
|
|
+ double avgViewCountSumFirst = 0D;
|
|
|
+ double showViewCountSumSecond = 0D;
|
|
|
+ double avgViewCountSumSecond = 0D;
|
|
|
for (ContentHisPublishArticle hisItem : content.getHisPublishArticleList()) {
|
|
|
if (hisItem.isInnerAccount() && hisItem.getShowViewCount() > 0 && hisItem.getAvgViewCount() > 0) {
|
|
|
- showViewCountSum += hisItem.getShowViewCount();
|
|
|
- avgViewCountSum += hisItem.getAvgViewCount();
|
|
|
+ if (hisItem.getItemIndex() == 1) {
|
|
|
+ showViewCountSumFirst += hisItem.getShowViewCount();
|
|
|
+ avgViewCountSumFirst += hisItem.getAvgViewCount();
|
|
|
+ } else if (hisItem.getItemIndex() == 2) {
|
|
|
+ showViewCountSumSecond += hisItem.getShowViewCount();
|
|
|
+ avgViewCountSumSecond += hisItem.getAvgViewCount();
|
|
|
+ } else {
|
|
|
+ showViewCountSum += hisItem.getShowViewCount();
|
|
|
+ avgViewCountSum += hisItem.getAvgViewCount();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
double viewCountRate = 0D; // 设置默认值
|
|
|
+ double minRate = 5D;
|
|
|
+ // 如果有头条反馈数据,优先选取头条反馈数据;
|
|
|
+ if (showViewCountSumFirst > 0) {
|
|
|
+ showViewCountSum = showViewCountSumFirst;
|
|
|
+ avgViewCountSum = avgViewCountSumFirst;
|
|
|
+ avgViewCountPos = avgViewCountFirst;
|
|
|
+ } else if (showViewCountSumSecond > 0) {
|
|
|
+ showViewCountSum = showViewCountSumSecond;
|
|
|
+ avgViewCountSum = avgViewCountSumSecond;
|
|
|
+ avgViewCountPos = avgViewCountFirst;
|
|
|
+ // 如果是大号头条,则降权
|
|
|
+ if (avgViewCountFirst >= 2000 && i == 0) {
|
|
|
+ minRate = 1.001D;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (avgViewCountSum > 0) {
|
|
|
viewCountRate = showViewCountSum / avgViewCountSum;
|
|
|
}
|
|
|
- double viewCountRateW = MathUtils.sigmoid(avgViewCountSum, 0.0005, firstAvgViewCount);
|
|
|
+ double viewCountRateW = MathUtils.sigmoid(avgViewCountSum, 0.0005, avgViewCountPos);
|
|
|
double viewCountRateScore = 0;
|
|
|
if (viewCountRate > 0) {
|
|
|
- viewCountRateScore = (Math.min(viewCountRate, 5) - 1D) * viewCountRateW;
|
|
|
+ viewCountRateScore = (Math.min(viewCountRate, minRate) - 1D) * viewCountRateW;
|
|
|
}
|
|
|
Score score = new Score();
|
|
|
score.setStrategy(this);
|