修复内容库分页:返回总数而非当前页数量
- 新增 get_articles_count 函数获取总数 - 列表API返回总数用于分页计算
This commit is contained in:
@@ -198,6 +198,14 @@ class Database:
|
||||
cursor.execute('DELETE FROM articles WHERE id = ?', (article_id,))
|
||||
conn.commit()
|
||||
return cursor.rowcount > 0
|
||||
|
||||
def get_articles_count(self):
|
||||
"""获取文章总数"""
|
||||
with self.get_connection() as conn:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT COUNT(*) as count FROM articles')
|
||||
row = cursor.fetchone()
|
||||
return row['count'] if row else 0
|
||||
|
||||
# ========== 待处理产品操作 ==========
|
||||
def add_pending_product(self, product_name, category=None, subcategory=None, priority=0, source='manual'):
|
||||
|
||||
Reference in New Issue
Block a user