Compare commits

...

5 Commits

Author SHA1 Message Date
Anyon
e640847819 清理文件时删除悬空记录 2022-07-19 18:08:38 +08:00
Anyon
52f379eb05 增加默认GIF图片 2022-07-19 17:06:55 +08:00
Anyon
d436e6a15b Revert "Update image.html"
This reverts commit 6a52e8aa3171048d9b68330f12190c6ac111b3f9.
2022-07-19 17:06:27 +08:00
Anyon
6a52e8aa31 Update image.html 2022-07-19 17:06:11 +08:00
Anyon
c084ff1fb1 存储类型从存储服务读取 2022-07-19 16:55:59 +08:00
2 changed files with 4 additions and 13 deletions

View File

@ -20,6 +20,7 @@ use think\admin\Controller;
use think\admin\helper\QueryHelper;
use think\admin\model\SystemFile;
use think\admin\service\AdminService;
use think\admin\Storage;
/**
* 系统文件管理
@ -28,18 +29,6 @@ use think\admin\service\AdminService;
*/
class File extends Controller
{
/**
* 存储方式处理
* @var string[]
*/
protected $types = [
'local' => '本地服务器存储',
'qiniu' => '七牛云对象存储',
'upyun' => '又拍云USS存储',
'alioss' => '阿里云OSS存储',
'txcos' => '腾讯云COS存储'
];
/**
* 系统文件管理
* @auth true
@ -50,6 +39,7 @@ class File extends Controller
*/
public function index()
{
$this->types = Storage::types();
SystemFile::mQuery()->layTable(function () {
$this->title = '系统文件管理';
$this->xexts = SystemFile::mk()->distinct()->column('xext');
@ -92,6 +82,7 @@ class File extends Controller
$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()->whereRaw("id not in {$db2->buildSql()}")->delete();
SystemFile::mk()->where($map)->where(['status' => 1])->delete();
$this->success('清理重复文件成功!');
}
}

View File

@ -104,7 +104,7 @@
// 加载页面数据
loadPage: function () {
this.params = {page: this.page, limit: this.limit, output: 'layui.table', name: this.keys || ''};
this.params.type = '{$get.type|default="png,jpg,jpeg"}';
this.params.type = '{$get.type|default="gif,png,jpg,jpeg"}';
$.form.load('{:url("image")}', this.params, 'get', function (ret) {
return app.setList(ret.data, ret.count), false;
});