Authored by chaogeng

马甲点赞逻辑优化

... ... @@ -114,7 +114,7 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{
}
//2)已有的点赞信息(正常的点赞,排除掉; 取消 再点赞的,不发站内信)
List<Integer> articleIds = articleList.stream().map(GrassArticle::getId).distinct().collect(Collectors.toList());
List<GrassArticlePraise> praiseList = grassArticlePraiseDao.selectByArticles(articleIds);
List<GrassArticlePraise> praiseList = grassArticlePraiseDao.selectByArticles(articleIds, allVirtualUids);
//3)点赞逻辑,要区分逛的作者 和 普通作者
List<GrassArticle> commonArtcileList = articleList.stream().filter(obj -> obj.getAuthorType() == null || obj.getAuthorType() == GrassUserTypeEnum.COMMON.getValue() )
... ... @@ -165,7 +165,7 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{
}
//2)已有的点赞信息(正常的点赞,排除掉; 取消 再点赞的,不发站内信)
List<Integer> articleIds = articleList.stream().map(GrassArticle::getId).distinct().collect(Collectors.toList());
List<GrassArticlePraise> praiseList = grassArticlePraiseDao.selectByArticles(articleIds);
List<GrassArticlePraise> praiseList = grassArticlePraiseDao.selectByArticles(articleIds, allVirtualUids);
//3)点赞逻辑,要区分逛的作者 和 普通作者
List<GrassArticle> commonArtcileList = articleList.stream().filter(obj -> obj.getAuthorType() == null || obj.getAuthorType() == GrassUserTypeEnum.COMMON.getValue() )
... ... @@ -351,18 +351,21 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{
String commonConfig = "";
String specialConfig = "";
int timeConfig = 0;
int pubTotalThre = 0;
switch (praiseType){
case publishPraise:
//发布文章点赞策略
commonConfig = configReader.getString("platform.grass.virtualpraise.pubThreshold","");
specialConfig = configReader.getString("platform.grass.virtualpraise.pubSpecialthreshold","");
timeConfig = configReader.getInt("platform.grass.virtual.time.pubInterval", 0);
pubTotalThre = configReader.getInt("platform.grass.virtual.time.pubTotalThre", 100);
break;
case recPraise:
//推荐文章点赞策略
commonConfig = configReader.getString("platform.grass.virtualpraise.recThreshold","");
specialConfig = configReader.getString("platform.grass.virtualpraise.recSpecialThreshold","");
timeConfig = configReader.getInt("platform.grass.virtual.time.recInterval", 0);
pubTotalThre = configReader.getInt("platform.grass.virtual.time.recTotalThre", 150);
break;
default:
return;
... ... @@ -395,8 +398,12 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{
for(GrassArticle article : articleList){
Integer articleId = article.getId();
int authorUid = article.getAuthorUid();
//选择虚拟马甲
//马甲点赞数超过阀值时,不再点赞
List<Integer> oldPraiseList = articlePraiseMap.get(articleId);
if(CollectionUtils.isNotEmpty(oldPraiseList) && oldPraiseList.size() > pubTotalThre){
continue;
}
//选择虚拟马甲
List<Integer> tempList = new ArrayList<>();
tempList.addAll(allVirtualUids);
if(CollectionUtils.isNotEmpty(oldPraiseList)){
... ...
... ... @@ -30,12 +30,16 @@ platform.grass.virtualpraise.pubThreshold = 10,3
platform.grass.virtualpraise.pubSpecialthreshold = 20,5
platform.grass.virtual.time.pubTotalThre = 100
platform.grass.virtual.time.recInterval = 0
platform.grass.virtualpraise.recThreshold = 10,5
platform.grass.virtualpraise.recSpecialThreshold = 20,10
platform.grass.virtual.time.recTotalThre = 150
... ...