作者 lyh

gx

@@ -290,14 +290,10 @@ class ImageController extends Controller @@ -290,14 +290,10 @@ 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); 293 $rs = $imageModel->add($data);
297 if ($rs === false) { 294 if ($rs === false) {
298 return $this->response('添加失败', Code::USER_ERROR); 295 return $this->response('添加失败', Code::USER_ERROR);
299 } 296 }
300 - }  
301 return true; 297 return true;
302 } 298 }
303 299
@@ -350,10 +346,12 @@ class ImageController extends Controller @@ -350,10 +346,12 @@ 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); 349 + $rs = $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
  350 + if($rs){
354 $this->synchronizationImage($fileName,$this->upload_location); 351 $this->synchronizationImage($fileName,$this->upload_location);
355 $data[] = $this->responseData($this->path.'/'.$fileName,$name); 352 $data[] = $this->responseData($this->path.'/'.$fileName,$name);
356 } 353 }
  354 + }
357 $this->response('图片资源',Code::SUCCESS,$data); 355 $this->response('图片资源',Code::SUCCESS,$data);
358 } 356 }
359 357