luojunhui пре 11 часа
родитељ
комит
ec264fcfe9
1 измењених фајлова са 40 додато и 40 уклоњено
  1. 40 40
      applications/tasks/data_recycle_tasks/recycle_outside_account_articles.py

+ 40 - 40
applications/tasks/data_recycle_tasks/recycle_outside_account_articles.py

@@ -196,19 +196,19 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
             return None
 
     async def fallback_mechanism(self):
-        # 通过msgId 来修改publish_timestamp
-        update_sql = f"""
-            update outside_account_articles oaa
-            join (
-                select gh_id, app_msg_id, max(publish_timestamp) as publish_timestamp 
-                from outside_account_articles
-                where publish_timestamp > %s 
-                group by gh_id, app_msg_id
-            ) vv on oaa.app_msg_id = vv.app_msg_id and oaa.gh_id = vv.gh_id
-            set oaa.publish_timestamp = vv.publish_timestamp
-            where oaa.publish_timestamp <= %s;
-        """
-        affected_rows_1 = await self.pool.async_save(query=update_sql, params=(0, 0))
+        # # 通过msgId 来修改publish_timestamp
+        # update_sql = f"""
+        #     update outside_account_articles oaa
+        #     join (
+        #         select gh_id, app_msg_id, max(publish_timestamp) as publish_timestamp
+        #         from outside_account_articles
+        #         where publish_timestamp > %s
+        #         group by gh_id, app_msg_id
+        #     ) vv on oaa.app_msg_id = vv.app_msg_id and oaa.gh_id = vv.gh_id
+        #     set oaa.publish_timestamp = vv.publish_timestamp
+        #     where oaa.publish_timestamp <= %s;
+        # """
+        # affected_rows_1 = await self.pool.async_save(query=update_sql, params=(0, 0))
 
         # 若还是无 publish_timestamp,用update_time当作 publish_timestamp
         update_sql_2 = f"""
@@ -217,11 +217,11 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
             where publish_timestamp < %s;
         """
         affected_rows_2 = await self.pool.async_save(query=update_sql_2, params=(0,))
-        if affected_rows_1 or affected_rows_2:
+        if affected_rows_2:
             await feishu_robot.bot(
                 title="执行兜底修改发布时间戳",
                 detail={
-                    "通过msgId修改": affected_rows_1,
+                    # "通过msgId修改": affected_rows_1,
                     "通过create_timestamp修改": affected_rows_2,
                 },
                 mention=False,
@@ -240,7 +240,7 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
                             "data": {
                                 "detail": {
                                     "url": task["ContentUrl"],
-                                    "wx_sn": task["wx_sn"].decode("utf-8"),
+                                    "wx_sn": task["wx_sn"],
                                 },
                                 "error_msg": traceback.format_exc(),
                                 "error": str(e),
@@ -253,30 +253,30 @@ class UpdateOutsideRootSourceIdAndUpdateTimeTask(UpdateRootSourceIdAndUpdateTime
                     print(e)
                     print(traceback.format_exc())
 
-        # process_failed_task_reproduce
-        fail_tasks = await self.get_article_list()
-        fail_list = []
-        for fail_task in tqdm(fail_tasks, desc="get article detail step2: "):
-            try:
-                res = await self.check_each_article(fail_task)
-                if res:
-                    fail_list.append(res)
-            except Exception as e:
-                await self.log_client.log(
-                    contents={
-                        "task": "get_official_article_detail_step2",
-                        "data": {
-                            "detail": {
-                                "url": fail_task["ContentUrl"],
-                                "wx_sn": fail_task["wx_sn"].decode("utf-8"),
-                            },
-                            "error_msg": traceback.format_exc(),
-                            "error": str(e),
-                        },
-                        "function": "check_each_article",
-                        "status": "fail",
-                    }
-                )
+        # # process_failed_task_reproduce
+        # fail_tasks = await self.get_article_list()
+        # fail_list = []
+        # for fail_task in tqdm(fail_tasks, desc="get article detail step2: "):
+        #     try:
+        #         res = await self.check_each_article(fail_task)
+        #         if res:
+        #             fail_list.append(res)
+        #     except Exception as e:
+        #         await self.log_client.log(
+        #             contents={
+        #                 "task": "get_official_article_detail_step2",
+        #                 "data": {
+        #                     "detail": {
+        #                         "url": fail_task["ContentUrl"],
+        #                         "wx_sn": fail_task["wx_sn"].decode("utf-8"),
+        #                     },
+        #                     "error_msg": traceback.format_exc(),
+        #                     "error": str(e),
+        #                 },
+        #                 "function": "check_each_article",
+        #                 "status": "fail",
+        #             }
+        #         )
         # if fail_list:
         #     await feishu_robot.bot(title="更新文章,获取detail失败", detail=fail_list)
         #