Files
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

19 lines
571 B
Python

import sqlite3, json
conn = sqlite3.connect('cms.db')
c = conn.cursor()
# 查看 news 模块 content
c.execute("SELECT id, code, content FROM home_modules WHERE type='news'")
row = c.fetchone()
print('news module:', row)
if row:
content = json.loads(row[2])
print('posts:', json.dumps(content.get('posts'), indent=2, ensure_ascii=False))
# 查看一些已发布文章的 cover_image 路径
c.execute("SELECT id, title, cover_image, slug FROM news_posts WHERE is_published=1 LIMIT 5")
for r in c.fetchall():
print('post:', r)
conn.close()