|
...
|
...
|
@@ -290,13 +290,9 @@ class ImageController extends Controller |
|
|
|
'name'=>$name,
|
|
|
|
'en_name'=>$fileName
|
|
|
|
];
|
|
|
|
$imageModel = new ImageModel();
|
|
|
|
$info = $imageModel->read(['hash'=>$hash,'project_id'=>$this->cache['project_id'] ?? 0]);
|
|
|
|
if($info === false){
|
|
|
|
$rs = $imageModel->add($data);
|
|
|
|
if ($rs === false) {
|
|
|
|
return $this->response('添加失败', Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$rs = $imageModel->add($data);
|
|
|
|
if ($rs === false) {
|
|
|
|
return $this->response('添加失败', Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
...
|
...
|
@@ -350,9 +346,11 @@ class ImageController extends Controller |
|
|
|
$amazonS3Service->uploadFiles($file,$this->path,$fileName);
|
|
|
|
}
|
|
|
|
//批量存储
|
|
|
|
$this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
|
|
|
|
$this->synchronizationImage($fileName,$this->upload_location);
|
|
|
|
$data[] = $this->responseData($this->path.'/'.$fileName,$name);
|
|
|
|
$rs = $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
|
|
|
|
if($rs){
|
|
|
|
$this->synchronizationImage($fileName,$this->upload_location);
|
|
|
|
$data[] = $this->responseData($this->path.'/'.$fileName,$name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('图片资源',Code::SUCCESS,$data);
|
|
|
|
}
|
...
|
...
|
|