|
@@ -376,6 +376,20 @@ public class RankStrategyBy834 extends RankStrategyBasic {
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(result)) {
|
|
if (CollectionUtils.isNotEmpty(result)) {
|
|
|
AdRankItem top1Item = result.get(0);
|
|
AdRankItem top1Item = result.get(0);
|
|
|
|
|
+
|
|
|
|
|
+ // 判断第一名是否是保量广告
|
|
|
|
|
+ boolean top1IsGuaranteed = top1Item.getExt().get("isGuaranteed") != null
|
|
|
|
|
+ && (boolean) top1Item.getExt().get("isGuaranteed");
|
|
|
|
|
+
|
|
|
|
|
+ // 如果第一名不是保量广告,则随机取一条,并取消保量标记
|
|
|
|
|
+ if (!top1IsGuaranteed && result.size() > 1) {
|
|
|
|
|
+ int randomIndex = random.nextInt(result.size());
|
|
|
|
|
+ top1Item = result.get(randomIndex);
|
|
|
|
|
+ // 随机取出的广告取消保量标记
|
|
|
|
|
+ top1Item.getExt().put("isGuaranteed", false);
|
|
|
|
|
+ top1Item.getExt().put("guaranteeWeight", 1.0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<String> participateCompetitionType = new ArrayList<>();
|
|
List<String> participateCompetitionType = new ArrayList<>();
|
|
|
participateCompetitionType.add("engine");
|
|
participateCompetitionType.add("engine");
|
|
|
top1Item.getExt().put("isGuaranteeType", isGuaranteeType);
|
|
top1Item.getExt().put("isGuaranteeType", isGuaranteeType);
|