|
...
|
...
|
@@ -49,13 +49,13 @@ class TencentCosService extends BaseService |
|
|
|
$objectKey = $path.'/'.$filename;
|
|
|
|
// 上传到腾讯云 COS
|
|
|
|
$httpClient = new Client();
|
|
|
|
$response = $httpClient->request('PUT', "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com/{$objectKey}", [
|
|
|
|
$response = $httpClient->request('PUT', "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$objectKey}", [
|
|
|
|
'body' => file_get_contents(config('filesystems.disks.upload')['root'].$objectKey),
|
|
|
|
'headers' => $this->generateHeaders($this->config['secretId'], $this->config['secretKey']),
|
|
|
|
]);
|
|
|
|
// 若上传成功,则返回上传后的 URL
|
|
|
|
if ($response->getStatusCode() === 200) {
|
|
|
|
return "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com/{$objectKey}";
|
|
|
|
return "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$objectKey}";
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
...
|
...
|
|