作者 lyh

gx

... ... @@ -210,10 +210,25 @@ class ImageController extends Controller
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
}
$this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name);
$this->synchronizationImage($fileName);
return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
}
/**
* @remark :指定同步文件到獨立177服務器
* @name :synchronizationFile
* @author :lyh
* @method :post
* @time :2024/4/8 11:10
*/
public function synchronizationImage($fileName){
//同步到大文件
$file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
shell_exec($cmd);
}
/**
* @remark :保存数据库
* @name :saveMysql
* @author :lyh
... ... @@ -290,6 +305,7 @@ class ImageController extends Controller
}
//批量存储
$this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
$this->synchronizationImage($fileName);
$data[] = $this->responseData($this->path.'/'.$fileName,$name);
}
$this->response('图片资源',Code::SUCCESS,$data);
... ...