Browse Source

Merge branch 'top-video' into test

liqian 3 years ago
parent
commit
4606085b43
2 changed files with 8 additions and 5 deletions
  1. 3 0
      config.py
  2. 5 5
      video_recall.py

+ 3 - 0
config.py

@@ -57,6 +57,9 @@ class BaseConfig(object):
     ROV_UPDATE_H = 6
     ROV_UPDATE_MINUTE = 30
 
+    # 置顶视频区域 为 全部 的code
+    ALL_AREA_CODE = '000000'
+
 
 class DevelopmentConfig(BaseConfig):
     """测试环境配置"""

+ 5 - 5
video_recall.py

@@ -391,12 +391,12 @@ class PoolRecall(object):
                 log_.info('=== item === {}'.format(item))
                 video_id = int(item['videoId'])
                 # 判断 视频推荐区域与用户地址信息 是否匹配,市级别
-                # video_area_list = item['area'].split(',')
-                if self.client_info.get('city') in item['area'] or '全部' == item['area']:
-                    log_.info('===2=== {}, ===3=== video_id: {}, area: {}'.format(
-                        self.client_info.get('city'), video_id, item['area']))
+                city_code_list = item['cityCode'].split(',')
+                if self.client_info.get('cityCode') in city_code_list or config_.ALL_AREA_CODE in city_code_list:
+                    log_.info('===2=== {}, ===3=== video_id: {}, cityCode: {}'.format(
+                        self.client_info.get('cityCode'), video_id, city_code_list))
                     video_ids.append(video_id)
-                    video_info[video_id] = {'score': item['score'], 'area': item['area']}
+                    video_info[video_id] = {'score': item['score'], 'cityCode': city_code_list}
 
             # 过滤
             filter_ = FilterVideos(app_type=self.app_type, video_ids=video_ids, mid=self.mid, uid=self.uid)