|
@@ -50,10 +50,13 @@ class FwhDataRecycle:
|
|
|
fetch_query = f"""
|
|
|
select account_name from long_articles_group_send_result where gh_id = %s limit 1;
|
|
|
"""
|
|
|
- fetch_response = self.long_articles_client.fetch(fetch_query, cursor_type=DictCursor, params=(gh_id,))
|
|
|
+ fetch_response = self.long_articles_client.fetch(
|
|
|
+ fetch_query, cursor_type=DictCursor, params=(gh_id,)
|
|
|
+ )
|
|
|
account_name = fetch_response[0]["account_name"] if fetch_response else None
|
|
|
return account_name
|
|
|
|
|
|
+
|
|
|
class FwhGroupPublishRecordManager(FwhDataRecycle):
|
|
|
|
|
|
def get_published_articles(self):
|
|
@@ -158,22 +161,26 @@ class FwhGroupPublishRecordManager(FwhDataRecycle):
|
|
|
where publish_date = %s
|
|
|
group by account_name, gh_id;
|
|
|
"""
|
|
|
- publish_records = self.long_articles_client.fetch(query=sql, cursor_type=DictCursor, params=(date_string,))
|
|
|
+ publish_records = self.long_articles_client.fetch(
|
|
|
+ query=sql, cursor_type=DictCursor, params=(date_string,)
|
|
|
+ )
|
|
|
self.feishu_robot.bot(
|
|
|
title=f"{date_string}服务号发文记录",
|
|
|
mention=False,
|
|
|
detail=publish_records,
|
|
|
- env="server_account_publish_monitor"
|
|
|
+ env="server_account_publish_monitor",
|
|
|
)
|
|
|
|
|
|
- publish_account_id_set = set([i['gh_id'] for i in publish_records])
|
|
|
+ publish_account_id_set = set([i["gh_id"] for i in publish_records])
|
|
|
for account_id in account_list:
|
|
|
if account_id not in publish_account_id_set:
|
|
|
account_name = self.get_server_account_name(account_id)
|
|
|
- do_not_publish_account.append({
|
|
|
- "account_name": account_name,
|
|
|
- "gh_id": account_id,
|
|
|
- })
|
|
|
+ do_not_publish_account.append(
|
|
|
+ {
|
|
|
+ "account_name": account_name,
|
|
|
+ "gh_id": account_id,
|
|
|
+ }
|
|
|
+ )
|
|
|
|
|
|
if do_not_publish_account:
|
|
|
self.feishu_robot.bot(
|
|
@@ -183,7 +190,6 @@ class FwhGroupPublishRecordManager(FwhDataRecycle):
|
|
|
)
|
|
|
|
|
|
|
|
|
-
|
|
|
class SaveFwhDataToDatabase(FwhDataRecycle):
|
|
|
|
|
|
def update_article_read_cnt(self, wx_sn, new_read_cnt):
|
|
@@ -365,8 +371,3 @@ 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__":
|
|
|
- w = FwhGroupPublishRecordManager()
|
|
|
- w.monitor('2025-06-21')
|