合并分支 'lms' 到 'develop'
v6优化程序 统计数据任务优化 查看合并请求 !285
正在显示
2 个修改的文件
包含
4 行增加
和
4 行删除
| @@ -157,7 +157,7 @@ class ProjectFilePDF extends Command | @@ -157,7 +157,7 @@ class ProjectFilePDF extends Command | ||
| 157 | // $pdf->save($savePath); | 157 | // $pdf->save($savePath); |
| 158 | // $binary = new File($savePath); | 158 | // $binary = new File($savePath); |
| 159 | 159 | ||
| 160 | - return $this->CosService->uploadFile($binary, $path, $filename . '.pdf'); | 160 | + return $this->CosService->uploadFile($binary, $path, $filename . '.pdf', true); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /** | 163 | /** |
| @@ -21,7 +21,7 @@ class CosService | @@ -21,7 +21,7 @@ class CosService | ||
| 21 | * @method :post | 21 | * @method :post |
| 22 | * @time :2023/7/19 15:28 | 22 | * @time :2023/7/19 15:28 |
| 23 | */ | 23 | */ |
| 24 | - public function uploadFile(&$files,$path,$filename) | 24 | + public function uploadFile(&$files,$path,$filename, $binary = false) |
| 25 | { | 25 | { |
| 26 | $cos = config('filesystems.disks.cos'); | 26 | $cos = config('filesystems.disks.cos'); |
| 27 | $cosClient = new Client([ | 27 | $cosClient = new Client([ |
| @@ -32,11 +32,11 @@ class CosService | @@ -32,11 +32,11 @@ class CosService | ||
| 32 | ], | 32 | ], |
| 33 | ]); | 33 | ]); |
| 34 | $key = $path.'/'.$filename; | 34 | $key = $path.'/'.$filename; |
| 35 | + $Body = $binary ? $files : fopen($files->getRealPath(), 'r'); | ||
| 35 | $cosClient->putObject([ | 36 | $cosClient->putObject([ |
| 36 | 'Bucket' => $cos['bucket'], | 37 | 'Bucket' => $cos['bucket'], |
| 37 | 'Key' => $key, | 38 | 'Key' => $key, |
| 38 | -// 'Body' => fopen($files->getRealPath(), 'r'), | ||
| 39 | - 'Body' => $files, | 39 | + 'Body' => $Body, |
| 40 | ]); | 40 | ]); |
| 41 | return $key; | 41 | return $key; |
| 42 | } | 42 | } |
-
请 注册 或 登录 后发表评论