parameter_update.py 888 B

1234567891011121314151617181920212223
  1. import json
  2. from db_helper import RedisHelper
  3. from config import set_config
  4. config_ = set_config()
  5. RISK_SHIELD_FILTER_RULE_V1_JSON = "RISK_SHIELD_FILTER_RULE_V1_JSON"
  6. def param_update_risk_rule():
  7. """
  8. 定时更新风险过滤的规则
  9. key=RISK_SHIELD_FILTER_RULE_V1_JSON
  10. value= "{\"VLOG\": [\"北京\"]}"
  11. """
  12. redis_helper = RedisHelper()
  13. global RISK_SHIELD_FILTER_RULE_V1_JSON
  14. level_weight_initial = redis_helper.get_data_from_redis(key_name=config_.FLOWPOOL_LEVEL_WEIGHT_KEY_NAME)
  15. if level_weight_initial is not None:
  16. RISK_SHIELD_FILTER_RULE_V1_JSON = json.loads(level_weight_initial)
  17. global flow_pool_abtest_config
  18. flow_pool_abtest_config = redis_helper.get_data_from_redis(key_name=config_.FLOWPOOL_ABTEST_KEY_NAME)
  19. if flow_pool_abtest_config is not None:
  20. flow_pool_abtest_config = json.loads(flow_pool_abtest_config)