正在显示
1 个修改的文件
包含
8 行增加
和
10 行删除
| @@ -290,13 +290,9 @@ class ImageController extends Controller | @@ -290,13 +290,9 @@ class ImageController extends Controller | ||
| 290 | 'name'=>$name, | 290 | 'name'=>$name, |
| 291 | 'en_name'=>$fileName | 291 | 'en_name'=>$fileName |
| 292 | ]; | 292 | ]; |
| 293 | - $imageModel = new ImageModel(); | ||
| 294 | - $info = $imageModel->read(['hash'=>$hash,'project_id'=>$this->cache['project_id'] ?? 0]); | ||
| 295 | - if($info === false){ | ||
| 296 | - $rs = $imageModel->add($data); | ||
| 297 | - if ($rs === false) { | ||
| 298 | - return $this->response('添加失败', Code::USER_ERROR); | ||
| 299 | - } | 293 | + $rs = $imageModel->add($data); |
| 294 | + if ($rs === false) { | ||
| 295 | + return $this->response('添加失败', Code::USER_ERROR); | ||
| 300 | } | 296 | } |
| 301 | return true; | 297 | return true; |
| 302 | } | 298 | } |
| @@ -350,9 +346,11 @@ class ImageController extends Controller | @@ -350,9 +346,11 @@ class ImageController extends Controller | ||
| 350 | $amazonS3Service->uploadFiles($file,$this->path,$fileName); | 346 | $amazonS3Service->uploadFiles($file,$this->path,$fileName); |
| 351 | } | 347 | } |
| 352 | //批量存储 | 348 | //批量存储 |
| 353 | - $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); | ||
| 354 | - $this->synchronizationImage($fileName,$this->upload_location); | ||
| 355 | - $data[] = $this->responseData($this->path.'/'.$fileName,$name); | 349 | + $rs = $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); |
| 350 | + if($rs){ | ||
| 351 | + $this->synchronizationImage($fileName,$this->upload_location); | ||
| 352 | + $data[] = $this->responseData($this->path.'/'.$fileName,$name); | ||
| 353 | + } | ||
| 356 | } | 354 | } |
| 357 | $this->response('图片资源',Code::SUCCESS,$data); | 355 | $this->response('图片资源',Code::SUCCESS,$data); |
| 358 | } | 356 | } |
-
请 注册 或 登录 后发表评论