Browse Source

Merge branch 'feature_20240509_zhaohaipeng_recommendflowpool_whiltelist' into pre-master

zhaohaipeng 1 year ago
parent
commit
093c437422

+ 8 - 11
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/RecallService.java

@@ -39,10 +39,10 @@ public class RecallService implements ApplicationContextAware {
     private BlacklistContainer blacklistContainer;
 
     /**
-     * 在流量池场景下,哪些appType用判断黑名单
+     * 在流量池场景下,哪些appType用判断黑名单
      */
-    @ApolloJsonValue("${content.security.recommendflowpool.whitelist.apptype.config:[]}")
-    private Set<Integer> contentSecurityWhitelistAppTypeSet;
+    @ApolloJsonValue("${content.security.recommendflowpool.blacklist.apptype.config:[]}")
+    private Set<Integer> blacklistAppTypeSet;
 
     @PostConstruct
     public void init() {
@@ -96,13 +96,10 @@ public class RecallService implements ApplicationContextAware {
             return strategies;
         }
 
-        // 白名单里的appType不判断黑名单
-        boolean hitUserBlacklist = false;
-        if (CollectionUtils.isEmpty(contentSecurityWhitelistAppTypeSet) || !contentSecurityWhitelistAppTypeSet.contains(param.getAppType())) {
             String matchUserBlacklistTypeEnum = blacklistContainer.matchUserBlacklistTypeEnum(param.getUid(), param.getHotSceneType(), param.getCityCode(),
                     param.getClientIp(), param.getMid(), "recommend-flow-pool", param.getAppType());
-            hitUserBlacklist = StringUtils.isNotBlank(matchUserBlacklistTypeEnum);
-        }
+        boolean hitUserBlacklist =  StringUtils.isNotBlank(matchUserBlacklistTypeEnum);
+        boolean isInBlacklist = CollectionUtils.isNotEmpty(blacklistAppTypeSet) && blacklistAppTypeSet.contains(param.getAppType());
 
         String abCode = param.getAbCode();
         //1:通过“产品”控制“召回子策略”
@@ -180,7 +177,7 @@ public class RecallService implements ApplicationContextAware {
                     strategies.addAll(getRegionRecallStrategy(param));
             }
             // 命中用户黑名单不走流量池
-            if (!hitUserBlacklist) {
+            if (!hitUserBlacklist || !isInBlacklist) {
                 //2:通过“流量池标记”控制“流量池召回子策略” 其中有9组会走EXPERIMENTAL_FLOW_SET_LEVEL 有1组会走EXPERIMENTAL_FLOW_SET_LEVEL_SCORE
                 if ("60116".equals(abCode)) {
                     int lastDigit = param.getLastDigit();
@@ -294,7 +291,7 @@ public class RecallService implements ApplicationContextAware {
                 case "60115": // 565
                 case "60117": // 567
                 case "60118": // 568
-                    if (!hitUserBlacklist) {
+                    if (!hitUserBlacklist || !isInBlacklist) {
                         strategies.add(strategyMap.get(FlowPoolLastDayTopRecallStrategy.class.getSimpleName()));
                     }
                     strategies.add(strategyMap.get(SimHotVideoRecallStrategy.class.getSimpleName()));
@@ -306,7 +303,7 @@ public class RecallService implements ApplicationContextAware {
                     break;
                 case "60110": // 新内容的召回(流量池的Top内容)
                     strategies.add(strategyMap.get(TopGoodPerformanceVideoRecallStrategy.class.getSimpleName()));
-                    if (!hitUserBlacklist) {
+                    if (!hitUserBlacklist || !isInBlacklist) {
                         strategies.add(strategyMap.get(FlowPoolLastDayTopRecallStrategy.class.getSimpleName()));
                     }
                     strategies.add(strategyMap.get(SimHotVideoRecallStrategy.class.getSimpleName()));