瀏覽代碼

Merge branch 'refs/heads/master' into pre-master

xueyiming 11 小時之前
父節點
當前提交
abde0ff8d1

+ 12 - 5
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/predict/model/threshold/RandomPredict667Model.java

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.ad.engine.service.predict.model.threshold;
 
 import com.alibaba.fastjson.JSONObject;
+import com.tzld.piaoquan.ad.engine.commons.util.DateUtils;
 import com.tzld.piaoquan.ad.engine.commons.util.JSONUtils;
 import com.tzld.piaoquan.ad.engine.service.predict.container.RandWContainer;
 import com.tzld.piaoquan.ad.engine.service.predict.param.ThresholdPredictModelParam;
@@ -27,14 +28,21 @@ public class RandomPredict667Model extends ThresholdPredictModel {
         hash = hash < 0 ? -hash : hash;
         double score = (hash + RandWContainer.getRandW()) % 100 / 100d;
 
-        String thresholdParamKey = modelParam.getAppType() + "_" + modelParam.getUserExtraFuture("shareType").toString().replace("return", "").replace("mids", "");
+        String keySuffix = modelParam.getUserExtraFuture("shareType").toString()
+                .replace("return", "")
+                .replace("mids", "");
 
-        double threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault(thresholdParamKey, -1).toString());
+        Integer appType = modelParam.getAppType();
+        String thresholdParamKey = appType + "_" + keySuffix;
 
+        double threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault(thresholdParamKey, -1).toString());
         if (threshold < 0d) {
-            thresholdParamKey = "default_threshold";
-            threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault(thresholdParamKey, "0.5").toString());
+            thresholdParamKey = "default_" + keySuffix;
+            threshold = Double.parseDouble(modelParam.getExtraParam().getOrDefault(thresholdParamKey, "-1").toString());
         }
+        double correction = Double.parseDouble(modelParam.getExtraParam().getOrDefault("E620_" + appType + "_" + DateUtils.getCurrentHour(), 1).toString());
+        threshold = threshold * correction;
+
         Map<String, Object> result = new HashMap<>();
         result.put("ad_predict", score < threshold ? 2 : 1);
         result.put("score", score);
@@ -51,7 +59,6 @@ public class RandomPredict667Model extends ThresholdPredictModel {
         logJson.put("abCode", modelParam.getAbTestCode());
         logJson.put("extraParam", modelParam.getExtraParam());
         logJson.put("shareType", modelParam.getUserExtraFuture("shareType").toString());
-        logJson.putAll(result);
 
         log.info("广告跳出选择 -- 667实验结果: {}, 参数: {}",
                 JSONUtils.toJson(result), logJson.toJSONString());

+ 3 - 0
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/predict/model/threshold/RandomPredictModel.java

@@ -56,6 +56,9 @@ public class RandomPredictModel extends ThresholdPredictModel {
         logJson.put("thresholdParamKey", thresholdParamKey);
         logJson.put("adPlatformType", modelParam.getAdPlatformType());
         logJson.put("abCode", modelParam.getAbTestCode());
+        logJson.put("extraParam", modelParam.getExtraParam());
+        logJson.put("shareType", modelParam.getUserExtraFuture("shareType").toString());
+
 
         log.info("广告跳出选择 -- 599实验结果: {}, 参数: {}",
                 JSONUtils.toJson(result), logJson.toJSONString());

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

@@ -307,7 +307,10 @@ public class RankStrategyBy688 extends RankStrategyBasic {
         double cpmCoefficient = weightParam.getOrDefault("cpmCoefficient", 0.9);
         boolean isGuaranteeType = false;
         // 查询人群分层信息
-        String peopleLayer = reqFeature.get("layer");
+        String peopleLayer = Optional.of(reqFeature)
+                .map(f -> f.get("layer"))
+                .map(s -> s.replace("-炸", ""))
+                .orElse(null);
         for (AdRankItem item : result) {
             double bid = item.getCpa();
             if (scoreParam.getExpCodeSet().contains(correctCpaExp1) || scoreParam.getExpCodeSet().contains(correctCpaExp2)) {