feat: 后台管理功能增强

1. 前端用户下拉菜单优化 - 改用CSS动画,解决鼠标移动问题
2. 帖子管理增加显示/隐藏开关
3. 帖子详情页可直接删除回复
4. 新增回复管理页面(列表、删除)
5. 用户管理增加编辑功能(用户名、邮箱、手机、简介)
6. 用户管理增加查看帖子按钮
7. 所有页面侧边栏添加回复管理入口
8. 数据库增加 is_hidden 字段
This commit is contained in:
2026-04-12 18:16:36 +08:00
parent e7ebc3a4d6
commit cd087e9931
9 changed files with 458 additions and 48 deletions

View File

@@ -54,6 +54,7 @@ class Database:
likes TEXT DEFAULT '[]',
views INTEGER DEFAULT 0,
is_pinned INTEGER DEFAULT 0,
is_hidden INTEGER DEFAULT 0,
created_at TEXT,
updated_at TEXT,
FOREIGN KEY (author_id) REFERENCES users(id)
@@ -317,6 +318,24 @@ class ReplyModel:
reply['likes'] = json.loads(reply['likes'] or '[]')
replies.append(reply)
return replies
def delete(self, reply_id):
"""删除回复"""
with self.db.get_conn() as conn:
conn.execute('DELETE FROM replies WHERE id = ?', (reply_id,))
conn.commit()
return True
def get_all(self, limit=50):
"""获取所有回复(后台管理用)"""
with self.db.get_conn() as conn:
rows = conn.execute('SELECT * FROM replies ORDER BY created_at DESC LIMIT ?', (limit,)).fetchall()
replies = []
for row in rows:
reply = dict(row)
reply['likes'] = json.loads(reply['likes'] or '[]')
replies.append(reply)
return replies
class TopicModel: