|
@@ -98,7 +98,7 @@ class RecycleDailyPublishArticlesTask(Const):
|
|
|
|
|
|
async def recycle_single_account(self, account):
|
|
|
"""recycle single account"""
|
|
|
- query = f"""
|
|
|
+ query = """
|
|
|
select max(publish_timestamp) as publish_timestamp from official_articles_v2 where ghId = %s;
|
|
|
"""
|
|
|
response = await self.pool.async_fetch(
|
|
@@ -189,7 +189,7 @@ class CheckDailyPublishArticlesTask(RecycleDailyPublishArticlesTask):
|
|
|
|
|
|
async def check_account(self, account: dict, date_string: str) -> bool:
|
|
|
"""check account data"""
|
|
|
- query = f"""
|
|
|
+ query = """
|
|
|
select accountName, count(1) as publish_count
|
|
|
from official_articles_v2 where ghId = %s and from_unixtime(publish_timestamp) > %s;
|
|
|
"""
|
|
@@ -280,7 +280,7 @@ class UpdateRootSourceIdAndUpdateTimeTask(Const):
|
|
|
self.log_client = log_client
|
|
|
|
|
|
async def get_article_list(self):
|
|
|
- query = f"""select ContentUrl, wx_sn from official_articles_v2 where publish_timestamp in %s;"""
|
|
|
+ query = """select ContentUrl, wx_sn from official_articles_v2 where publish_timestamp in %s;"""
|
|
|
article_list = await self.pool.async_fetch(
|
|
|
query=query, db_name="piaoquan_crawler", params=(tuple([0, -1]),)
|
|
|
)
|
|
@@ -306,9 +306,7 @@ class UpdateRootSourceIdAndUpdateTimeTask(Const):
|
|
|
mini_program = data.get("mini_program", [])
|
|
|
if mini_program:
|
|
|
root_source_id_list = [
|
|
|
- urllib.parse.parse_qs(urllib.parse.unquote(i["path"]))[
|
|
|
- "rootSourceId"
|
|
|
- ][0]
|
|
|
+ urllib.parse.parse_qs(urllib.parse.unquote(i["path"])).get("root_source_id", [""])[0]
|
|
|
for i in mini_program
|
|
|
]
|
|
|
else:
|
|
@@ -333,7 +331,7 @@ class UpdateRootSourceIdAndUpdateTimeTask(Const):
|
|
|
"status": "fail",
|
|
|
}
|
|
|
)
|
|
|
- query = f"""
|
|
|
+ query = """
|
|
|
update official_articles_v2 set publish_timestamp = %s, root_source_id_list = %s
|
|
|
where wx_sn = %s;
|
|
|
"""
|
|
@@ -347,6 +345,7 @@ class UpdateRootSourceIdAndUpdateTimeTask(Const):
|
|
|
),
|
|
|
)
|
|
|
if publish_timestamp_s == self.REQUEST_FAIL_STATUS:
|
|
|
+ article['wx_sn'] = wx_sn
|
|
|
return article
|
|
|
else:
|
|
|
return None
|