mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-07-07 08:41:12 +08:00
Compare commits
No commits in common. "648f7b7b1c1a3ea39c79ff9fe5e2c234532efe22" and "4167ea48c4eca539db126eb70e970a1e2191a996" have entirely different histories.
648f7b7b1c
...
4167ea48c4
@ -120,6 +120,81 @@ class Upload extends Controller
|
||||
$this->success('获取上传授权参数', array_merge($data, ['id' => $file->id ?? 0]), 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件状态
|
||||
* @login true
|
||||
* @return void
|
||||
*/
|
||||
public function done()
|
||||
{
|
||||
$data = $this->_vali([
|
||||
'id.require' => '编号不能为空!',
|
||||
'hash.require' => '哈希不能为空!',
|
||||
'uuid.value' => AdminService::getUserId(),
|
||||
]);
|
||||
$file = SystemFile::mk()->where($data)->findOrEmpty();
|
||||
if ($file->isEmpty()) $this->error('文件不存在!');
|
||||
if ($file->save(['status' => 2])) {
|
||||
$this->success('更新成功!');
|
||||
} else {
|
||||
$this->error('更新失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件选择器
|
||||
* @login true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function image()
|
||||
{
|
||||
SystemFile::mQuery()->layTable(function () {
|
||||
$this->title = '文件选择器';
|
||||
}, function (QueryHelper $query) {
|
||||
$query->where(['status' => 2, 'issafe' => 0, 'uuid' => AdminService::getUserId()]);
|
||||
$query->like('name,hash')->in('xext#type')->dateBetween('create_at')->order('id desc');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频选择器
|
||||
* @login true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
SystemFile::mQuery()->layTable(function () {
|
||||
$this->title = '文件选择器';
|
||||
}, function (QueryHelper $query) {
|
||||
$query->like('name,hash')->dateBetween('create_at')->order('id desc');
|
||||
$query->where(['status' => 2, 'issafe' => 0, 'uuid' => AdminService::getUserId()]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档选择器
|
||||
* @login true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function document()
|
||||
{
|
||||
SystemFile::mQuery()->layTable(function () {
|
||||
$this->title = '文件选择器';
|
||||
}, function (QueryHelper $query) {
|
||||
$query->like('name,hash')->dateBetween('create_at')->order('id desc');
|
||||
$query->where(['status' => 2, 'issafe' => 0, 'uuid' => AdminService::getUserId()]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传入口
|
||||
* @login true
|
||||
@ -180,45 +255,6 @@ class Upload extends Controller
|
||||
$this->error($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件状态
|
||||
* @login true
|
||||
* @return void
|
||||
*/
|
||||
public function done()
|
||||
{
|
||||
$data = $this->_vali([
|
||||
'id.require' => '编号不能为空!',
|
||||
'hash.require' => '哈希不能为空!',
|
||||
'uuid.value' => AdminService::getUserId(),
|
||||
]);
|
||||
$file = SystemFile::mk()->where($data)->findOrEmpty();
|
||||
if ($file->isEmpty()) $this->error('文件不存在!');
|
||||
if ($file->save(['status' => 2])) {
|
||||
$this->success('更新成功!');
|
||||
} else {
|
||||
$this->error('更新失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件选择器
|
||||
* @login true
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function image()
|
||||
{
|
||||
SystemFile::mQuery()->layTable(function () {
|
||||
$this->title = '文件选择器';
|
||||
}, function (QueryHelper $query) {
|
||||
$query->where(['status' => 2, 'issafe' => 0, 'uuid' => AdminService::getUserId()]);
|
||||
$query->like('name,hash')->in('xext#type')->dateBetween('create_at')->order('id desc');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件上传类型
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user