liqian 2 роки тому
батько
коміт
9f44a92b45
1 змінених файлів з 6 додано та 3 видалено
  1. 6 3
      region_rule_rank_h.py

+ 6 - 3
region_rule_rank_h.py

@@ -524,7 +524,7 @@ def process_with_app_type(app_type, params, region_code_list, feature_df, now_da
     # gevent.joinall(task_list)
 
 
-def copy_data_for_city(region, city_code, data_key, rule_key, now_date, now_h):
+def copy_data_for_city(region, city_code, data_key, rule_key, now_date, now_h, shield_config):
     """copy 对应数据到城市对应redis,并做相应屏蔽视频过滤"""
     log_.info(f"city_code = {city_code} start ...")
     redis_helper = RedisHelper()
@@ -545,7 +545,8 @@ def copy_data_for_city(region, city_code, data_key, rule_key, now_date, now_h):
             continue
         # 屏蔽视频过滤
         region_video_ids = [int(video_id) for video_id, _ in region_data]
-        shield_key_name_list = config_.SHIELD_CONFIG.get(city_code, None)
+        shield_key_name_list = shield_config.get(city_code, None)
+        # shield_key_name_list = config_.SHIELD_CONFIG.get(city_code, None)
         if shield_key_name_list is not None:
             filtered_video_ids = filter_shield_video(video_ids=region_video_ids,
                                                      shield_key_name_list=shield_key_name_list)
@@ -607,11 +608,13 @@ def process_with_param(param, data_params_item, rule_params_item, region_code_li
     gevent.joinall(task_list)
 
     # 特殊城市视频数据准备
+    # 屏蔽视频过滤
+    shield_config = rule_param.get('shield_config', config_.SHIELD_CONFIG)
     for region, city_list in config_.REGION_CITY_MAPPING.items():
         t = [
             gevent.spawn(
                 copy_data_for_city,
-                region, city_code, data_key, rule_key, now_date, now_h
+                region, city_code, data_key, rule_key, now_date, now_h, shield_config
             )
             for city_code in city_list
         ]