diff --git a/app/admin/controller/File.php b/app/admin/controller/File.php
index dd41ff147..c9a675e20 100644
--- a/app/admin/controller/File.php
+++ b/app/admin/controller/File.php
@@ -80,4 +80,18 @@ class File extends Controller
{
SystemFile::mDelete();
}
+
+ /**
+ * 清理重复文件
+ * @auth true
+ * @return void
+ */
+ public function distinct()
+ {
+ $map = ['uuid' => AdminService::getUserId()];
+ $db1 = SystemFile::mk()->fieldRaw('max(id) id')->where($map)->group('hash');
+ $db2 = $this->app->db->table($db1->buildSql())->alias('dt')->field('id');
+ SystemFile::mk()->whereRaw("id not in {$db2->buildSql()}")->delete();
+ $this->success('清理重复文件记录');
+ }
}
\ No newline at end of file
diff --git a/app/admin/view/file/index.html b/app/admin/view/file/index.html
index 3e1584d7f..bf975b95e 100644
--- a/app/admin/view/file/index.html
+++ b/app/admin/view/file/index.html
@@ -1,6 +1,9 @@
{extend name='table'}
{block name="button"}
+
+清理重复
+
批量删除