作者 lyh

gx

... ... @@ -61,6 +61,11 @@ class FileController
*/
public function index($hash = '')
{
// 检查是否有修改日期或ETag头部
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
header("HTTP/1.1 304 Not Modified");
exit;
}
$fileModel = new File();
$info = $fileModel->read(['hash' => $hash]);
if ($info === false) {
... ... @@ -124,6 +129,7 @@ class FileController
if($file_hash !== false){
return $this->response('资源',Code::SUCCESS,['file'=>$hash,'file_link'=>$this->getFileUrl($fileModel,$hash)]);
}
$this->path = '/files';
$url = $this->config['root'].$this->path;
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
//同步数据到cos
... ...