作者 lyh

gx

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