diff --git a/app.py b/app.py index 662f0a7..826722b 100644 --- a/app.py +++ b/app.py @@ -3744,25 +3744,6 @@ def api_create_post_with_poll(): def api_share_post(post_id): return jsonify({'success': True}) -@app.route('/api/posts//pin', methods=['POST']) -@login_required -def api_pin_post(post_id): - """置顶/取消置顶帖子(仅管理员)""" - user = session.get('user') - if user.get('role') != 'admin': - return jsonify({'success': False, 'message': '只有管理员可以置顶帖子'}), 403 - - post = Post.query.get(post_id) - if not post: - return jsonify({'success': False, 'message': '帖子不存在'}), 404 - - # 切换置顶状态 - post.pinned = not post.pinned - db.session.commit() - - action = '置顶' if post.pinned else '取消置顶' - return jsonify({'success': True, 'message': f'帖子已{action}', 'pinned': post.pinned}) - # ========== 聊天系统页面 ========== @app.route('/chat') @login_required