作者 lyh

gx

@@ -82,7 +82,9 @@ class FileController @@ -82,7 +82,9 @@ class FileController
82 } 82 }
83 $size = $info['size']; 83 $size = $info['size'];
84 // 设置Content-Type头部 84 // 设置Content-Type头部
85 - $header['Content-Type'] = 'video/' . $info['type']; 85 + if($info['type'] == 'mp4'){
  86 + $header['Content-Type'] = 'video/' . $info['type'];
  87 + }
86 // 设置Accept-Ranges头部 88 // 设置Accept-Ranges头部
87 $header['Accept-Ranges'] = 'bytes'; 89 $header['Accept-Ranges'] = 'bytes';
88 // 检查是否有范围请求 90 // 检查是否有范围请求
@@ -285,9 +287,9 @@ class FileController @@ -285,9 +287,9 @@ class FileController
285 * @method :post 287 * @method :post
286 * @time :2023/6/26 16:28 288 * @time :2023/6/26 16:28
287 */ 289 */
288 - public function downLoad($hash){ 290 + public function downLoad(){
289 $file_model = new File(); 291 $file_model = new File();
290 - $info = $file_model->read(['hash' => $hash]); 292 + $info = $file_model->read(['hash' => $this->param['hash']]);
291 if ($info === false) { 293 if ($info === false) {
292 $this->response('指定文件不存在!', Code::USER_ERROR); 294 $this->response('指定文件不存在!', Code::USER_ERROR);
293 } 295 }