mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-07-06 16:21:17 +08:00
Compare commits
2 Commits
4167ea48c4
...
648f7b7b1c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
648f7b7b1c | ||
|
|
e9a80653da |
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件上传类型
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user