作者 lyh

gx

... ... @@ -318,8 +318,8 @@ class ImageController extends Controller
private function multi(&$files) {
$data = [];
foreach ($files as $file) {
try {
$hash = hash_file('sha256', $file->getPathname());
$name = $file->getClientOriginalName();
$imageModel = new ImageModel();
//查看图片是否已上传
$param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
... ... @@ -331,8 +331,9 @@ class ImageController extends Controller
$data[] = $this->responseData($image_hash['path'],$image_hash['name']);
continue;
}
$image_type = $file->getClientOriginalExtension();
$name = $file->getClientOriginalName();
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
$image_type = $file->getClientOriginalExtension();
$this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
//同步数据到cos
if($this->upload_location == 0){
... ... @@ -345,7 +346,9 @@ class ImageController extends Controller
}
$this->synchronizationImage($fileName,$this->upload_location);
$data[] = $this->responseData($this->path.'/'.$fileName,$name);
$hash = $name = '';
}catch (\Exception $e){
$this->response('图片资源',Code::SUCCESS,$data);
}
}
$this->response('图片资源',Code::SUCCESS,$data);
}
... ...