作者 李美松

v6优化程序 统计数据任务优化

... ... @@ -157,7 +157,7 @@ class ProjectFilePDF extends Command
// $pdf->save($savePath);
// $binary = new File($savePath);
return $this->CosService->uploadFile($binary, $path, $filename . '.pdf');
return $this->CosService->uploadFile($binary, $path, $filename . '.pdf', true);
}
/**
... ...
... ... @@ -21,7 +21,7 @@ class CosService
* @method :post
* @time :2023/7/19 15:28
*/
public function uploadFile(&$files,$path,$filename)
public function uploadFile(&$files,$path,$filename, $binary = false)
{
$cos = config('filesystems.disks.cos');
$cosClient = new Client([
... ... @@ -32,11 +32,11 @@ class CosService
],
]);
$key = $path.'/'.$filename;
$Body = $binary ? $files : fopen($files->getRealPath(), 'r');
$cosClient->putObject([
'Bucket' => $cos['bucket'],
'Key' => $key,
// 'Body' => fopen($files->getRealPath(), 'r'),
'Body' => $files,
'Body' => $Body,
]);
return $key;
}
... ...