正在显示
1 个修改的文件
包含
6 行增加
和
0 行删除
| @@ -61,6 +61,11 @@ class FileController | @@ -61,6 +61,11 @@ class FileController | ||
| 61 | */ | 61 | */ |
| 62 | public function index($hash = '') | 62 | public function index($hash = '') |
| 63 | { | 63 | { |
| 64 | + // 检查是否有修改日期或ETag头部 | ||
| 65 | + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { | ||
| 66 | + header("HTTP/1.1 304 Not Modified"); | ||
| 67 | + exit; | ||
| 68 | + } | ||
| 64 | $fileModel = new File(); | 69 | $fileModel = new File(); |
| 65 | $info = $fileModel->read(['hash' => $hash]); | 70 | $info = $fileModel->read(['hash' => $hash]); |
| 66 | if ($info === false) { | 71 | if ($info === false) { |
| @@ -124,6 +129,7 @@ class FileController | @@ -124,6 +129,7 @@ class FileController | ||
| 124 | if($file_hash !== false){ | 129 | if($file_hash !== false){ |
| 125 | return $this->response('资源',Code::SUCCESS,['file'=>$hash,'file_link'=>$this->getFileUrl($fileModel,$hash)]); | 130 | return $this->response('资源',Code::SUCCESS,['file'=>$hash,'file_link'=>$this->getFileUrl($fileModel,$hash)]); |
| 126 | } | 131 | } |
| 132 | + $this->path = '/files'; | ||
| 127 | $url = $this->config['root'].$this->path; | 133 | $url = $this->config['root'].$this->path; |
| 128 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 134 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 129 | //同步数据到cos | 135 | //同步数据到cos |
-
请 注册 或 登录 后发表评论