mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
增加文件清理操作
This commit is contained in:
parent
7526721b4a
commit
525834a40d
@ -80,4 +80,18 @@ class File extends Controller
|
|||||||
{
|
{
|
||||||
SystemFile::mDelete();
|
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('清理重复文件记录');
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,9 @@
|
|||||||
{extend name='table'}
|
{extend name='table'}
|
||||||
|
|
||||||
{block name="button"}
|
{block name="button"}
|
||||||
|
<!--{if auth("distinct")}-->
|
||||||
|
<a data-table-id="FileTable" data-load='{:url("distinct")}' class='layui-btn layui-btn-sm layui-btn-primary'>清理重复</a>
|
||||||
|
<!--{/if}-->
|
||||||
<!--{if auth("remove")}-->
|
<!--{if auth("remove")}-->
|
||||||
<a data-confirm="确定永久删除这些账号吗?" data-table-id="FileTable" data-action='{:url("remove")}' data-rule="id#{id}" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</a>
|
<a data-confirm="确定永久删除这些账号吗?" data-table-id="FileTable" data-action='{:url("remove")}' data-rule="id#{id}" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</a>
|
||||||
<!--{/if}-->
|
<!--{/if}-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user