fanjinyang 5 päivää sitten
vanhempi
commit
7fa1d508e2

+ 16 - 0
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBasic.java

@@ -7,6 +7,7 @@ import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;
 import com.tzld.piaoquan.ad.engine.commons.enums.CrowdLayerEnum;
 import com.tzld.piaoquan.ad.engine.commons.enums.FilterTypeEnum;
 import com.tzld.piaoquan.ad.engine.commons.enums.RedisPrefixEnum;
+import com.tzld.piaoquan.ad.engine.commons.helper.CreativeKFinalDataHelper;
 import com.tzld.piaoquan.ad.engine.commons.helper.LayerAgentFlowControlDataHelper;
 import com.tzld.piaoquan.ad.engine.commons.helper.LayerCustomerFlowControlDataHelper;
 import com.tzld.piaoquan.ad.engine.commons.param.RankRecommendRequestParam;
@@ -1385,6 +1386,8 @@ public abstract class RankStrategyBasic implements RankStrategy {
                     }
                 }
             }
+
+            calCreativeKFinalWeight("kFinal",items);
         } catch (Exception e) {
             log.error("cal rerank weight error", e);
         }
@@ -1435,6 +1438,19 @@ public abstract class RankStrategyBasic implements RankStrategy {
         }
     }
 
+
+    // 加V打压系数
+    protected void calCreativeKFinalWeight(String flowCtlType, List<AdRankItem> items) {
+        try {
+            for (AdRankItem item : items) {
+                Double kFinal = CreativeKFinalDataHelper.getKFinal(item.getCreativeCode());
+                item.getScoreMap().put(flowCtlType, kFinal);
+            }
+        } catch (Exception e) {
+            log.error("calCreativeKFinalWeight weight error", e);
+        }
+    }
+
     private double getFlowControlWeight(Pair<Double, Double> pair,
                                         double cpmPow, double lowerCpmWeight, double upperCpmWeight,
                                         double flowPow, double lowerFlowWeight, double upperFlowWeight,

+ 2 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy851.java

@@ -413,13 +413,14 @@ public class RankStrategyBy851 extends RankStrategyBasic {
             // 控制流量权重
             double flowCtlC = item.getScoreMap().getOrDefault("flowCtlC", 1.0);
             double flowCtlA = item.getScoreMap().getOrDefault("flowCtlA", 1.0);
+            double kFinal = item.getScoreMap().getOrDefault("kFinal", 1.0);
 
             String layerAndCreativeWeightMapKey = getLayerAndCreativeWeightMapKey(peopleLayer, String.valueOf(item.getAdId()));
             // 人群分层&创意的权重
             double layerAndCreativeWeight = getLayerAndCreativeWeight(layerAndCreativeWeightMapKey);
             double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
             double guaranteeScoreCoefficient = getGuaranteeScoreCoefficient(isGuaranteedFlow, item.getExt());
-            double score = flowCtlC * flowCtlA * h5Weight * expWeight * item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight;
+            double score = flowCtlC * flowCtlA * h5Weight * expWeight * item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight * kFinal;
             item.getScoreMap().put("guaranteeScoreCoefficient", guaranteeScoreCoefficient);
             item.getScoreMap().put("cpa", item.getCpa());
             item.getScoreMap().put("cpm", item.getCpm());