作者 lyh

gx

@@ -113,7 +113,12 @@ class FileController @@ -113,7 +113,12 @@ class FileController
113 $name = $files->getClientOriginalName(); 113 $name = $files->getClientOriginalName();
114 //查看文件是否存在 114 //查看文件是否存在
115 $fileModel = new File(); 115 $fileModel = new File();
116 - $file_hash = $fileModel->read(['hash'=>$hash]); 116 + //查看图片是否已上传
  117 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0];
  118 + if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
  119 + $param['project_id'] = $this->cache['project_id'];
  120 + }
  121 + $file_hash = $fileModel->read($param);
117 if($file_hash !== false){ 122 if($file_hash !== false){
118 return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name)); 123 return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name));
119 } 124 }
@@ -173,7 +178,11 @@ class FileController @@ -173,7 +178,11 @@ class FileController
173 $fileModel = new File(); 178 $fileModel = new File();
174 $name = $file->getClientOriginalName(); 179 $name = $file->getClientOriginalName();
175 $hash = hash_file('md5', $file->getPathname()); 180 $hash = hash_file('md5', $file->getPathname());
176 - $file_hash = $fileModel->read(['hash'=>$hash]); 181 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0];
  182 + if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
  183 + $param['project_id'] = $this->cache['project_id'];
  184 + }
  185 + $file_hash = $fileModel->read($param);
177 if($file_hash !== false){ 186 if($file_hash !== false){
178 $data[] = $this->responseData($file_hash['path'], $name); 187 $data[] = $this->responseData($file_hash['path'], $name);
179 continue; 188 continue;