From cb211d8ba15facb536b082bd4e9e137aa163da37 Mon Sep 17 00:00:00 2001 From: dami Date: Sun, 7 Sep 2025 12:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=94=B6=E7=AB=99-=E6=B0=B8=E4=B9=85?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/admin/files/recycle.py | 8 +++++++- web/utils/file.py | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/web/admin/files/recycle.py b/web/admin/files/recycle.py index 5cc69fb67..e02b40a53 100644 --- a/web/admin/files/recycle.py +++ b/web/admin/files/recycle.py @@ -21,7 +21,7 @@ import core.mw as mw import utils.file as file from .files import blueprint -# 回收站文件 +# 回收站文件列表 @blueprint.route('/get_recycle_bin', endpoint='get_recycle_bin', methods=['POST']) @panel_login_required def get_recycle_bin(): @@ -34,6 +34,12 @@ def re_recycle_bin(): path = request.form.get('path', '') return file.reRecycleBin(path) +@blueprint.route('/del_recycle_bin', endpoint='del_recycle_bin', methods=['POST']) +@panel_login_required +def del_recycle_bin(): + path = request.form.get('path', '') + return file.delRecycleBin(path) + # 回收站文件 @blueprint.route('/recycle_bin', endpoint='recycle_bin', methods=['POST']) @panel_login_required diff --git a/web/utils/file.py b/web/utils/file.py index 3b14b27e3..1bb51a179 100644 --- a/web/utils/file.py +++ b/web/utils/file.py @@ -838,6 +838,20 @@ def getRecycleBin(): return mw.returnJson(True, 'OK', data) +def delRecycleBin(path): + rb_dir = mw.getRecycleBinDir() + rb_file = rb_dir + '/' + path + if os.path.isdir(rb_file): + import shutil + shutil.rmtree(rb_file) + else: + os.remove(rb_file) + + tfile = path.replace('_mw_', '/').split('_t_')[0] + msg = mw.getInfo('已彻底从回收站删除{1}!', (tfile,)) + mw.writeLog('文件管理', msg) + return mw.returnJson(True, msg) + # 移动到回收站 def mvRecycleBin(path): rb_dir = mw.getRecycleBinDir()