Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
1 个修改的文件
包含
12 行增加
和
2 行删除
| @@ -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 | } |
| @@ -150,6 +155,7 @@ class FileController | @@ -150,6 +155,7 @@ class FileController | ||
| 150 | 'refer'=>$this->param['refer'] ?? 1, | 155 | 'refer'=>$this->param['refer'] ?? 1, |
| 151 | 'is_cos'=>$is_cos, | 156 | 'is_cos'=>$is_cos, |
| 152 | 'mime'=>$mime, | 157 | 'mime'=>$mime, |
| 158 | + 'project_id'=>$this->cache['project_id'] ?? 0, | ||
| 153 | 'name'=>$name, | 159 | 'name'=>$name, |
| 154 | ]; | 160 | ]; |
| 155 | $rs = $fileModel->add($data); | 161 | $rs = $fileModel->add($data); |
| @@ -172,7 +178,11 @@ class FileController | @@ -172,7 +178,11 @@ class FileController | ||
| 172 | $fileModel = new File(); | 178 | $fileModel = new File(); |
| 173 | $name = $file->getClientOriginalName(); | 179 | $name = $file->getClientOriginalName(); |
| 174 | $hash = hash_file('md5', $file->getPathname()); | 180 | $hash = hash_file('md5', $file->getPathname()); |
| 175 | - $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); | ||
| 176 | if($file_hash !== false){ | 186 | if($file_hash !== false){ |
| 177 | $data[] = $this->responseData($file_hash['path'], $name); | 187 | $data[] = $this->responseData($file_hash['path'], $name); |
| 178 | continue; | 188 | continue; |
-
请 注册 或 登录 后发表评论