From 7bb0124bbec284e02dadd5bbf9f6851a86f1c8f5 Mon Sep 17 00:00:00 2001 From: shufeng2012 <277665039@qq.com> Date: Fri, 24 Jul 2026 08:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=AD=90=E8=8A=82=E7=82=B9=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dnfs/dnfs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dnfs/dnfs.py b/dnfs/dnfs.py index d922026..9ca9746 100755 --- a/dnfs/dnfs.py +++ b/dnfs/dnfs.py @@ -118,12 +118,20 @@ def delete_note(): note_id = data.get('id') - if not note_id: + if note_id: return jsonify({"error": "Note ID is required"}), 400 with app.app_context(): + notes = Note.query.filter(Note.pid == int(note_id)) + + # 有子节点的情况不可删除 + if not notes: + + return jsonify({'error': 'this node has a child'}), 400 + + note = Note.query.get(note_id) if note: