作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -66,8 +66,8 @@ class AmazonS3Service
*/
public function syncImageFiles($files)
{
$file_link = $this->fetchRemoteImage($files);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('图片:'.$file_link, true) . PHP_EOL, FILE_APPEND);
$location = '/tmp'.str_replace_url($files);
$file_link = $this->fetchRemoteImage($files,$location);
$key = str_replace_url($files);
try {
$context = stream_context_create([
... ... @@ -82,6 +82,7 @@ class AmazonS3Service
'Key' => ltrim($key,'/'),
'Body' => $file_content,
]);
unlink($location);
return $result['ObjectURL'];
} catch (AwsException $e) {
return '上传文件到S3时发生错误:' . $e->getMessage();
... ... @@ -95,7 +96,7 @@ class AmazonS3Service
* @method :post
* @time :2024/1/26 12:48
*/
public function fetchRemoteImage($url, $localPath = '/tmp/file.jpg') {
public function fetchRemoteImage($url, $localPath) {
// 创建 cURL 句柄
$curl = curl_init();
// 设置 cURL 选项
... ...