ソースを参照

修改统计周期

luojunhui 2 週間 前
コミット
1145f62cd2
1 ファイル変更8 行追加2 行削除
  1. 8 2
      tasks/data_tasks/fwh_data_recycle.py

+ 8 - 2
tasks/data_tasks/fwh_data_recycle.py

@@ -23,7 +23,7 @@ class FwhDataRecycle:
 
     PUBLISH_SUCCESS_STATUS = 2
 
-    STAT_PERIOD = 2 * 24 * 3600
+    STAT_PERIOD = 3 * 24 * 3600
 
     ARTICLE_ILLEGAL_CODE = 25012
 
@@ -247,10 +247,11 @@ class SaveFwhDataToDatabase(FwhDataRecycle):
             from long_articles_group_send_result
             where gh_id = %s and recycle_status = %s and create_time > %s;
         """
+        earliest_time = datetime.fromtimestamp(earliest_timestamp).strftime("%Y-%m-%d %H:%M:%S")
         return self.long_articles_client.fetch(
             fetch_query,
             DictCursor,
-            (gh_id, self.RECYCLE_SUCCESS_STATUS, earliest_timestamp),
+            (gh_id, self.RECYCLE_SUCCESS_STATUS, earliest_time),
         )
 
     def process_each_account_data(self, account_published_article_list):
@@ -404,3 +405,8 @@ class FwhDataExportTemp(FwhDataRecycle):
                     print(f"article {article['ContentUrl']} is not available, skip it")
         df = pd.DataFrame(L)
         df.to_csv("temp2.csv", index=False)
+
+
+if __name__ == "__main__":
+    article_list = SaveFwhDataToDatabase().get_stat_published_articles("gh_5e543853d8f0")
+    print(article_list)