luojunhui 3 mesi fa
parent
commit
3f9986e670
1 ha cambiato i file con 21 aggiunte e 14 eliminazioni
  1. 21 14
      server/api/record.py

+ 21 - 14
server/api/record.py

@@ -131,20 +131,27 @@ class Record(object):
         将content_id, channel_content_id 记录
         将content_id, channel_content_id 记录
         """
         """
         insert_sql = f"""
         insert_sql = f"""
-        INSERT IGNORE INTO 
-            crawler_produce_id_map
-        (channel_content_id, content_id)
-        VALUES
-        (%s, %s);
+            INSERT IGNORE INTO 
+                crawler_produce_id_map
+            (channel_content_id, content_id)
+            VALUES
+            (%s, %s);
         """
         """
-        await self.mysql_client.async_insert(
-            sql=insert_sql,
-            params={
-                self.channel_content_id,
-                self.content_id
-            }
-        )
-
+        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):
     async def deal(self):
         """
         """
         deal
         deal
@@ -160,7 +167,7 @@ class Record(object):
             # 判断是否传参数:channel_content_id
             # 判断是否传参数:channel_content_id
             if self.channel_content_id:
             if self.channel_content_id:
                 await self.input_channel_content_id()
                 await self.input_channel_content_id()
-                
+
             res = {
             res = {
                 "status": "success input to article queue",
                 "status": "success input to article queue",
                 "code": 0,
                 "code": 0,