From 946924cdb58553058f30ce0bd219bec13da37a24 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Tue, 9 Dec 2025 09:57:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E6=95=B0=E6=8D=AE=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=88=A0=E9=99=A4=E5=9B=BE=E7=89=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/enterprise/model/File.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/enterprise/model/File.php b/app/enterprise/model/File.php index 7659933..6410779 100644 --- a/app/enterprise/model/File.php +++ b/app/enterprise/model/File.php @@ -47,9 +47,21 @@ class File extends BaseModel // 删除图片数据 $file->where('file_id', $file_id)->delete(); + self::againDelete($file_id, $item->src); return true; } } return false; } + + protected static function againDelete($file_id,$src) + { + $existsFilePath = public_path() . '/' . ltrim($src,'/'); + if (!file_exists($existsFilePath)) { + File::where('file_id', $file_id)->delete(); + Emoji::where(['file_id'=>$file_id])->delete(); + PostsFile::where(['file_id'=>$file_id])->delete(); + Message::where(['file_id'=>$file_id])->delete(); + } + } } \ No newline at end of file