From f6b10b676df2c8e6c71ad587dba9d4867ae0f479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 11 Mar 2025 19:50:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/think-plugs-admin/src/controller/File.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugin/think-plugs-admin/src/controller/File.php b/plugin/think-plugs-admin/src/controller/File.php index 7cd0395d5..c8391c768 100644 --- a/plugin/think-plugs-admin/src/controller/File.php +++ b/plugin/think-plugs-admin/src/controller/File.php @@ -109,10 +109,8 @@ class File extends Controller public function distinct() { $map = ['issafe' => 0, 'uuid' => AdminService::getUserId()]; - $db1 = SystemFile::mk()->fieldRaw('max(id) id')->where($map)->group('type,xkey'); - $db2 = $this->app->db->table($db1->buildSql())->alias('dt')->field('id'); - SystemFile::mk()->where($map)->whereRaw("id not in {$db2->buildSql()}")->delete(); - SystemFile::mk()->where($map)->where(['status' => 1])->delete(); + $subQuery = SystemFile::mk()->fieldRaw('MAX(id) AS id')->where($map)->group('type, xkey')->buildSql(); + SystemFile::mk()->where($map)->whereRaw("id NOT IN ({$subQuery})")->delete(); $this->success('清理重复文件成功!'); } } \ No newline at end of file