Browse Source

add strategy: 00:00-08:00 no ad

liqian 1 year ago
parent
commit
ab073fafc0
1 changed files with 9 additions and 0 deletions
  1. 9 0
      ad_recommend.py

+ 9 - 0
ad_recommend.py

@@ -355,6 +355,15 @@ def ad_recommend_predict(app_type, mid, video_id, ab_exp_info, ab_test_code, car
     try:
     try:
         now_date = datetime.datetime.today()
         now_date = datetime.datetime.today()
         # now_dt = datetime.datetime.strftime(now_date, '%Y%m%d')
         # now_dt = datetime.datetime.strftime(now_date, '%Y%m%d')
+        now_h = datetime.datetime.now().hour
+        if 0 <= now_h < 8:
+            # 00:00 - 08:00 不出广告
+            ad_predict = 1
+            result = {
+                'now_h': now_h,
+                'ad_predict': ad_predict
+            }
+            return result
         # 获取实验参数
         # 获取实验参数
         abtest_id, abtest_config_tag = get_params(ab_exp_info=ab_exp_info, ab_test_code=ab_test_code)
         abtest_id, abtest_config_tag = get_params(ab_exp_info=ab_exp_info, ab_test_code=ab_test_code)
         if abtest_id is None or abtest_config_tag is None:
         if abtest_id is None or abtest_config_tag is None: