|
@@ -5,6 +5,7 @@ import com.tzld.longarticle.recommend.server.service.recommend.config.AccountCon
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.Score;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreParam;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreStrategy;
|
|
|
+import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -29,7 +30,7 @@ public class CrawlerDaysDecreaseStrategy implements ScoreStrategy {
|
|
|
if (CollectionUtils.isEmpty(param.getContents())) {
|
|
|
return scores;
|
|
|
}
|
|
|
- long now = System.currentTimeMillis();
|
|
|
+ long now = DateUtils.getTodayStart();
|
|
|
for (Content content : param.getContents()) {
|
|
|
String[] contentPools = accountContentPoolConfigService.getContentPools(param.getAccountName());
|
|
|
if (!contentPools[2].equals(content.getContentPoolType())) {
|
|
@@ -48,7 +49,9 @@ public class CrawlerDaysDecreaseStrategy implements ScoreStrategy {
|
|
|
double maxReleaseScore = -0.3;
|
|
|
double maxScoreDays = 60.0;
|
|
|
int days = (int) ((now - content.getCrawlerTimestamp()) / 86400000);
|
|
|
- if (days < maxScoreDays) {
|
|
|
+ if (days < 0) {
|
|
|
+ return 0.0;
|
|
|
+ } else if (days < maxScoreDays) {
|
|
|
return maxReleaseScore * (days / maxScoreDays);
|
|
|
}
|
|
|
return maxReleaseScore;
|