|
...
|
...
|
@@ -32,13 +32,46 @@ class FileManageController extends BaseController |
|
|
|
$this->upload_config = $project['upload_config'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :列表
|
|
|
|
* @name :index
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/28 17:03
|
|
|
|
*/
|
|
|
|
public function index(FileManage $fileManage){
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
$this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%'];
|
|
|
|
$lists = $fileManage->lists($this->map, $this->page, $this->row);
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
$v['download_url'] = url('b/file_manager_downLoad?path='.$v['path']);
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :下载方法
|
|
|
|
* @name :downLoad
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/28 17:18
|
|
|
|
*/
|
|
|
|
public function downLoad(){
|
|
|
|
$file_model = new FileManage();
|
|
|
|
$info = $file_model->read(['hash' => $this->param['hash']]);
|
|
|
|
if ($info === false) {
|
|
|
|
$this->response('指定文件不存在!', Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$fileUrl = 'https://file.globalso.com'.$info['path'];
|
|
|
|
// 设置响应头
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
|
|
header('Content-Disposition: attachment; filename="' . $info['name'] . '"');
|
|
|
|
// 下载文件
|
|
|
|
readfile($fileUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function upload(Request $request, FileManage $fileManage){
|
|
|
|
$request->validate([
|
|
|
|
'file'=>['required'],
|
...
|
...
|
|