modify scripts

This commit is contained in:
oscarz
2025-03-23 16:02:24 +08:00
parent be399e81a4
commit db09f2786e

View File

@ -48,12 +48,12 @@ def check_dirty_chapters():
for i in range(100): for i in range(100):
table_name = f'{tbl_name_chapters_prefix}_{i}' table_name = f'{tbl_name_chapters_prefix}_{i}'
try: try:
cursor.execute(f"SELECT count(*) FROM {table_name} WHERE created_at >= '2025-03-23 10:20:00' and created_at <= '2025-03-23 11:20:00' ") cursor.execute(f"SELECT count(*) FROM {table_name} WHERE updated_at >= '2025-03-23 10:20:00' and updated_at <= '2025-03-23 11:20:00' ")
row = cursor.fetchone() row = cursor.fetchone()
if row: if row:
dirty_chapters_all += row[0] dirty_chapters_all += row[0]
cursor.execute(f"SELECT count(*) FROM {table_name} WHERE created_at >= '2025-03-23 10:20:00' and created_at <= '2025-03-23 11:20:00' and content like '%aabook%' ") cursor.execute(f"SELECT count(*) FROM {table_name} WHERE updated_at >= '2025-03-23 10:20:00' and updated_at <= '2025-03-23 11:20:00' and content like '%aabook%' ")
row = cursor.fetchone() row = cursor.fetchone()
if row: if row:
dirty_chapters += row[0] dirty_chapters += row[0]
@ -70,7 +70,7 @@ def update_dirty_chapters():
for i in range(100): for i in range(100):
table_name = f'{tbl_name_chapters_prefix}_{i}' table_name = f'{tbl_name_chapters_prefix}_{i}'
try: try:
cursor.execute(f"update {table_name} set has_content = 0 WHERE created_at >= '2025-03-23 10:20:00' and created_at <= '2025-03-23 11:20:00' ") cursor.execute(f"update {table_name} set has_content = 0 WHERE updated_at >= '2025-03-23 10:20:00' and updated_at <= '2025-03-23 11:20:00' ")
updated_rows = cursor.rowcount updated_rows = cursor.rowcount
print(f"update {table_name}, affected rows: {updated_rows}") print(f"update {table_name}, affected rows: {updated_rows}")