作者 张关杰

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

@@ -287,7 +287,7 @@ class ImageController extends Controller @@ -287,7 +287,7 @@ class ImageController extends Controller
287 }else{ 287 }else{
288 //TODO::上传亚马逊 288 //TODO::上传亚马逊
289 $amazonS3Service = new AmazonS3Service(); 289 $amazonS3Service = new AmazonS3Service();
290 - $amazonS3Service->uploadFiles($files,$this->path,$fileName); 290 + $amazonS3Service->uploadFiles($file,$this->path,$fileName);
291 } 291 }
292 //批量存储 292 //批量存储
293 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); 293 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
@@ -45,16 +45,16 @@ class AmazonS3Service @@ -45,16 +45,16 @@ class AmazonS3Service
45 $key = $s3Key.'/'.$filename; 45 $key = $s3Key.'/'.$filename;
46 $body = fopen($files->getRealPath(), 'r'); 46 $body = fopen($files->getRealPath(), 'r');
47 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($body, true) . PHP_EOL, FILE_APPEND); 47 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($body, true) . PHP_EOL, FILE_APPEND);
48 -// try {  
49 -// $result = $this->s3->putObject([  
50 -// 'Bucket' => $this->bucket,  
51 -// 'Key' => $key,  
52 -// 'SourceFile' => $Body,  
53 -// 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改  
54 -// ]);  
55 -// return $result['ObjectURL'];  
56 -// } catch (S3Exception $e) {  
57 -// return false;  
58 -// } 48 + try {
  49 + $result = $this->s3->putObject([
  50 + 'Bucket' => $this->bucket,
  51 + 'Key' => $key,
  52 + 'SourceFile' => $body,
  53 + 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
  54 + ]);
  55 + return $result['ObjectURL'];
  56 + } catch (S3Exception $e) {
  57 + return false;
  58 + }
59 } 59 }
60 } 60 }