소스 검색

fix: 修复SQL字段错误

SongZihuan 2 년 전
부모
커밋
4d42f2ffc8
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      sql/blog.py

+ 3 - 2
sql/blog.py

@@ -94,7 +94,8 @@ def get_blog_count() -> int:
 
 def get_archive_blog_list(archive_id, limit: Optional[int] = None, offset: Optional[int] = None) -> list:
     """ 获得指定归档的 blog 列表 """
-    cur = db.search(columns=["BlogID", "Title", "SubTitle", "UpdateTime", "CreateTime", "Top"], table="blog_with_archive",
+    cur = db.search(columns=["BlogID", "Title", "SubTitle", "UpdateTime", "CreateTime", "Top"],
+                    table="blog_with_archive",
                     order_by=[("CreateTime", "DESC"), ("Title", "ASC"), ("SubTitle", "ASC")],
                     where=f"ArchiveID={archive_id}",
                     limit=limit,
@@ -106,7 +107,7 @@ def get_archive_blog_list(archive_id, limit: Optional[int] = None, offset: Optio
 
 def get_archive_blog_count(archive_id) -> int:
     """ 统计指定归档的 blog 个数 """
-    cur = db.search(columns=["count(ID)"], table="blog_with_archive",
+    cur = db.search(columns=["count(BlogID)"], table="blog_with_archive",
                     where=f"ArchiveID={archive_id}")
     if cur is None or cur.rowcount == 0:
         return 0