Browse Source

Merge branch '2025-01-04-fission-rerank' of Server/title_with_video into master

luojunhui 3 months ago
parent
commit
63b7681d30
1 changed files with 32 additions and 0 deletions
  1. 32 0
      server/api/record.py

+ 32 - 0
server/api/record.py

@@ -18,6 +18,7 @@ class Record(object):
         self.title = None
         self.gh_id = None
         self.publish_flag = None
+        self.channel_content_id = None
         self.params = params
         self.mysql_client = mysql_client
         self.article_match_video_table = config.article_match_video_table
@@ -37,6 +38,7 @@ class Record(object):
             self.content_id = self.params['articleId']
             self.flow_pool_level = self.params['flowPoolLevelTag']
             self.publish_flag = self.params.get('publishFlag', 1)
+            self.channel_content_id = self.params.get("channelContentId")
             logging(
                 code="1001",
                 info="搜索视频内容接口请求成功, 参数校验成功",
@@ -124,6 +126,32 @@ class Record(object):
                 trace_id=self.trace_id
             )
 
+    async def input_channel_content_id(self):
+        """
+        将content_id, channel_content_id 记录
+        """
+        insert_sql = f"""
+            INSERT IGNORE INTO 
+                crawler_produce_id_map
+            (channel_content_id, content_id)
+            VALUES
+            (%s, %s);
+        """
+        try:
+            await self.mysql_client.async_insert(
+                sql=insert_sql,
+                params={
+                    self.channel_content_id,
+                    self.content_id
+                }
+            )
+        except Exception as e:
+            logging(
+                code="1002",
+                info="insert channel_content_id_error: {}".format(e),
+                function="Record",
+                trace_id=self.trace_id
+            )
     async def deal(self):
         """
         deal
@@ -136,6 +164,10 @@ class Record(object):
             # 记录数据
             await self.input_into_article_match_video_table()
             await self.input_into_article_text_table()
+            # 判断是否传参数:channel_content_id
+            if self.channel_content_id:
+                await self.input_channel_content_id()
+
             res = {
                 "status": "success input to article queue",
                 "code": 0,