Browse Source

采用裂变信息重排序

luojunhui 5 months ago
parent
commit
bf9afca9ce
1 changed files with 32 additions and 2 deletions
  1. 32 2
      applications/match_algorithm/rank.py

+ 32 - 2
applications/match_algorithm/rank.py

@@ -88,7 +88,37 @@ async def get_content_oss_fission_dict(db_client, config, content_id) -> dict[st
         return {}
 
 
+async def get_title_oss_fission_dict(db_client, config, content_id) -> dict[str: float]:
+    """
+    通过 content_id 对应的 oss 路径对应的裂变表现进行排序
+    oss 数据每天凌晨 2 点更新
+    :return:
+    """
+    FISSION_DETAIL_TABLE = config.fission_detail_table
+    LONG_ARTICLES_TEXT_TABLE = config.long_article_text_table
 
 
-
-
+    # two_days_ago_dt = (datetime.now() - timedelta(days=2)).strftime('%Y%m%d')
+    # sql = f"""
+    #     SELECT
+    #         oss_name, fission_rate_0, fission_0_on_read
+    #     FROM
+    #         {FISSION_DETAIL_TABLE}
+    #     WHERE content_id = '{content_id}' and dt >= '{two_days_ago_dt}'
+    #     ORDER BY dt DESC;
+    # """
+    # result = await db_client.select(sql)
+    # fission_info_dict = {}
+    # if result:
+    #     for item in result:
+    #         key = item[0]
+    #         value = {
+    #             "fission_rate_0": item[1],
+    #             "fission_0_on_read": item[2]
+    #         }
+    #         if fission_info_dict.get(key):
+    #             continue
+    #         else:
+    #             fission_info_dict[key] = value
+    # else:
+    #     return {}