Merge remote-tracking branch 'origin/develop' into akun
正在显示
1 个修改的文件
包含
3 行增加
和
11 行删除
| @@ -225,20 +225,12 @@ class FileController | @@ -225,20 +225,12 @@ class FileController | ||
| 225 | */ | 225 | */ |
| 226 | public function downLoad(){ | 226 | public function downLoad(){ |
| 227 | $file_model = new File(); | 227 | $file_model = new File(); |
| 228 | - $info = $file_model->read(['path' => str_replace_url($this->param['path'])]); | 228 | + $info = $file_model->read(['path' => str_replace_url($this->param['path'])]); |
| 229 | if ($info === false) { | 229 | if ($info === false) { |
| 230 | $this->response('指定文件不存在!', Code::USER_ERROR); | 230 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 231 | } | 231 | } |
| 232 | - if($info['is_cos'] == 1){ | ||
| 233 | - $cos = new CosService(); | ||
| 234 | - $fileUrl = $cos->getImageUrl($info['path']); | ||
| 235 | - }else{ | ||
| 236 | - $fileUrl = $this->config['root'].$info['path']; | ||
| 237 | - if (!is_file($fileUrl)) { | ||
| 238 | - $this->response('指定文件已被系统删除!', Code::USER_ERROR); | ||
| 239 | - } | ||
| 240 | - } | ||
| 241 | - $fileName = basename($info['path']); // 要保存的文件名 | 232 | + $fileUrl = getFileUrl($info['path'],$info['is_cos']); |
| 233 | + $fileName = basename($fileUrl); // 要保存的文件名 | ||
| 242 | // 设置响应头 | 234 | // 设置响应头 |
| 243 | header('Content-Description: File Transfer'); | 235 | header('Content-Description: File Transfer'); |
| 244 | header('Content-Type: application/octet-stream'); | 236 | header('Content-Type: application/octet-stream'); |
-
请 注册 或 登录 后发表评论