|
...
|
...
|
@@ -48,7 +48,7 @@ class FileManageController extends BaseController |
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($lists, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
if(!empty($lists) && !empty($lists)){
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
$v['download_url'] = url('b/file_manager_downLoad?hash='.$v['hash']);
|
|
|
|
$v['download_url'] = url('b/file_manager_downLoad?hash='.$v['path']);
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -63,16 +63,12 @@ class FileManageController extends BaseController |
|
|
|
* @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'];
|
|
|
|
$username = basename($this->param['path']);
|
|
|
|
$fileUrl = 'https://file.globalso.com'.$this->param['path'];
|
|
|
|
// 设置响应头
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
|
|
header('Content-Disposition: attachment; filename="' . $info['name'] . '"');
|
|
|
|
header('Content-Disposition: attachment; filename="' . $username . '"');
|
|
|
|
// 下载文件
|
|
|
|
readfile($fileUrl);
|
|
|
|
}
|
...
|
...
|
|