作者 lyh

gx

... ... @@ -113,7 +113,12 @@ class FileController
$name = $files->getClientOriginalName();
//查看文件是否存在
$fileModel = new File();
$file_hash = $fileModel->read(['hash'=>$hash]);
//查看图片是否已上传
$param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0];
if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
$param['project_id'] = $this->cache['project_id'];
}
$file_hash = $fileModel->read($param);
if($file_hash !== false){
return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name));
}
... ... @@ -173,7 +178,11 @@ class FileController
$fileModel = new File();
$name = $file->getClientOriginalName();
$hash = hash_file('md5', $file->getPathname());
$file_hash = $fileModel->read(['hash'=>$hash]);
$param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0];
if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
$param['project_id'] = $this->cache['project_id'];
}
$file_hash = $fileModel->read($param);
if($file_hash !== false){
$data[] = $this->responseData($file_hash['path'], $name);
continue;
... ...