luojunhui 4 months ago
parent
commit
8359ee08e1
1 changed files with 11 additions and 11 deletions
  1. 11 11
      tasks/update_published_articles_read_detail.py

+ 11 - 11
tasks/update_published_articles_read_detail.py

@@ -22,7 +22,7 @@ from applications.const import updatePublishedMsgTaskConst
 from applications.db import DatabaseConnector
 from config import denet_config, long_articles_config, piaoquan_crawler_config
 
-ARTICLE_TABLE = "official_articles_v2"
+ARTICLE_TABLE = "official_articles"
 const = updatePublishedMsgTaskConst()
 spider = WeixinSpider()
 functions = Functions()
@@ -258,12 +258,12 @@ class UpdatePublishedArticlesReadDetail(object):
                     account_info=account_info,
                     msg_list=msg_list
                 )
-                if last_time_stamp_in_this_msg > latest_update_time:
-                    next_cursor = response['data']['next_cursor']
-                    return self.update_account_by_spider(
-                        account_info=account_info,
-                        cursor=next_cursor
-                    )
+                # if last_time_stamp_in_this_msg > latest_update_time:
+                #     next_cursor = response['data']['next_cursor']
+                #     return self.update_account_by_spider(
+                #         account_info=account_info,
+                #         cursor=next_cursor
+                #     )
                 log(
                     task="updatePublishedMsgDaily",
                     function="update_each_account",
@@ -628,12 +628,12 @@ class UpdatePublishedArticlesReadDetail(object):
         update_sql = f"""
             UPDATE {ARTICLE_TABLE} oav 
             JOIN (
-                SELECT appMsgId, MAX(publish_timestamp) AS publish_timestamp 
+                SELECT ghId, appMsgId, MAX(publish_timestamp) AS publish_timestamp 
                 FROM {ARTICLE_TABLE} 
                 WHERE publish_timestamp > %s 
-                GROUP BY appMsgId
-                ) vv 
-                ON oav.appMsgId = vv.appMsgId
+                GROUP BY ghId, appMsgId
+                ) vv
+                ON oav.appMsgId = vv.appMsgId and oav.ghId = vv.ghId
             SET oav.publish_timestamp = vv.publish_timestamp
             WHERE oav.publish_timestamp <= %s;
         """