|
@@ -519,6 +519,10 @@ def update_publish_timestamp(db_client, row):
|
|
json.dumps(root_source_id_list, ensure_ascii=False),
|
|
json.dumps(root_source_id_list, ensure_ascii=False),
|
|
wx_sn
|
|
wx_sn
|
|
))
|
|
))
|
|
|
|
+ if publish_timestamp_s == REQUEST_FAIL_STATUS:
|
|
|
|
+ return row
|
|
|
|
+ else:
|
|
|
|
+ return None
|
|
|
|
|
|
|
|
|
|
def get_article_detail_job():
|
|
def get_article_detail_job():
|
|
@@ -547,6 +551,41 @@ def get_article_detail_job():
|
|
print(e)
|
|
print(e)
|
|
error_msg = traceback.format_exc()
|
|
error_msg = traceback.format_exc()
|
|
print(error_msg)
|
|
print(error_msg)
|
|
|
|
+ # check 一遍存在请求失败-1 && 0 的文章
|
|
|
|
+ process_failed_articles = get_articles(db_client)
|
|
|
|
+ fail_list = []
|
|
|
|
+ if process_failed_articles:
|
|
|
|
+ for article in tqdm(process_failed_articles):
|
|
|
|
+ try:
|
|
|
|
+ res = update_publish_timestamp(db_client=db_client, row=article)
|
|
|
|
+ fail_list.append({"wx_sn": res[1], "url": res[0]})
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(e)
|
|
|
|
+ error_msg = traceback.format_exc()
|
|
|
|
+ print(error_msg)
|
|
|
|
+
|
|
|
|
+ # 通过msgId 来修改publish_time_stamp
|
|
|
|
+ update_sql = f"""
|
|
|
|
+ UPDATE official_articles_v2 oav
|
|
|
|
+ JOIN (
|
|
|
|
+ SELECT appMsgId, MAX(publish_timestamp) AS publish_timestamp
|
|
|
|
+ FROM official_articles_v2
|
|
|
|
+ WHERE publish_timestamp > %s
|
|
|
|
+ GROUP BY appMsgId
|
|
|
|
+ ) vv
|
|
|
|
+ ON oav.appMsgId = vv.appMsgId
|
|
|
|
+ SET oav.publish_timestamp = vv.publish_timestamp
|
|
|
|
+ WHERE oav.publish_timestamp <= %s;
|
|
|
|
+ """
|
|
|
|
+ affected_rows = db_client.update(
|
|
|
|
+ sql=update_sql,
|
|
|
|
+ params=(0, 0)
|
|
|
|
+ )
|
|
|
|
+ if fail_list:
|
|
|
|
+ bot(
|
|
|
|
+ title="更新文章任务,请求detail失败",
|
|
|
|
+ detail=fail_list
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|