作者 刘锟

Merge remote-tracking branch 'origin/develop' into akun

... ... @@ -225,20 +225,12 @@ class FileController
*/
public function downLoad(){
$file_model = new File();
$info = $file_model->read(['path' => str_replace_url($this->param['path'])]);
$info = $file_model->read(['path' => str_replace_url($this->param['path'])]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
if($info['is_cos'] == 1){
$cos = new CosService();
$fileUrl = $cos->getImageUrl($info['path']);
}else{
$fileUrl = $this->config['root'].$info['path'];
if (!is_file($fileUrl)) {
$this->response('指定文件已被系统删除!', Code::USER_ERROR);
}
}
$fileName = basename($info['path']); // 要保存的文件名
$fileUrl = getFileUrl($info['path'],$info['is_cos']);
$fileName = basename($fileUrl); // 要保存的文件名
// 设置响应头
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
... ...