|
@@ -72,6 +72,12 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
@Value("${user.source.layer.ad.rate.exp.ids:673,676}")
|
|
|
private String userSourceLayerAdRateExpIds;
|
|
|
|
|
|
+ @Value("${advance.show.ad.global.flag:false}")
|
|
|
+ private boolean advanceShowAdGlobalFlag;
|
|
|
+
|
|
|
+ @Value("${advance.show.ad.switch:true}")
|
|
|
+ private boolean advanceShowAdSwitch;
|
|
|
+
|
|
|
@Autowired
|
|
|
private AdRedisHelper adRedisHelper;
|
|
|
|
|
@@ -125,18 +131,14 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
result.put("ad_predict", 1);
|
|
|
result.put("no_ad_strategy", "no_ad_time_with_time_plan");
|
|
|
return result;
|
|
|
+ } else if (isAdvanceShowAd()) {
|
|
|
+ log.info("提前出广告");
|
|
|
} else if (
|
|
|
- (!condition1 || !condition2) && 0 <= hourOfDay && hourOfDay < 8) {
|
|
|
-
|
|
|
- String day = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDateTime.now());
|
|
|
- String redisKey = String.format(RedisPrefixEnum.ADVANCE_SHOW_AD_FLAG.getPrefix(), day);
|
|
|
- String flag = adRedisHelper.get(redisKey);
|
|
|
- if (StringUtils.equals("0", flag)) {
|
|
|
- // 0点到8点 && (未开启555 || 555配置不包含abcode)
|
|
|
- result.put("ad_predict", 1);
|
|
|
- result.put("no_ad_strategy", "no_ad_time_with_fixed_time");
|
|
|
- return result;
|
|
|
- }
|
|
|
+ (!condition1 || !condition2) && 0 <= hourOfDay && hourOfDay < 20) {
|
|
|
+ // 0点到8点 && (未开启555 || 555配置不包含abcode)
|
|
|
+ result.put("ad_predict", 1);
|
|
|
+ result.put("no_ad_strategy", "no_ad_time_with_fixed_time");
|
|
|
+ return result;
|
|
|
}
|
|
|
String abtestId = null;
|
|
|
String abTestConfigTag = null;
|
|
@@ -372,4 +374,18 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ private boolean isAdvanceShowAd() {
|
|
|
+ if (advanceShowAdGlobalFlag) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!advanceShowAdSwitch) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String day = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDateTime.now());
|
|
|
+ String redisKey = String.format(RedisPrefixEnum.ADVANCE_SHOW_AD_FLAG.getPrefix(), day);
|
|
|
+ String flag = adRedisHelper.get(redisKey);
|
|
|
+ return StringUtils.equals("1", flag);
|
|
|
+ }
|
|
|
}
|