Compare commits

...

2 Commits

Author SHA1 Message Date
Anyon
648f7b7b1c
修改文件上传
Signed-off-by: Anyon <zoujingli@qq.com>
2022-11-23 14:06:06 +00:00
Anyon
e9a80653da
去除其他文件选择器
Signed-off-by: Anyon <zoujingli@qq.com>
2022-11-23 14:05:18 +00:00

View File

@ -120,81 +120,6 @@ 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
@ -255,6 +180,45 @@ 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');
});
}
/**
* 获取文件上传类型