作者 lyh

gx

@@ -47,12 +47,13 @@ class TencentCosService extends BaseService @@ -47,12 +47,13 @@ class TencentCosService extends BaseService
47 $contentType = 'image/'.$image_type; 47 $contentType = 'image/'.$image_type;
48 date_default_timezone_set('Asia/Shanghai'); 48 date_default_timezone_set('Asia/Shanghai');
49 $date = date('D, d M Y H:i:s \G\M\T'); 49 $date = date('D, d M Y H:i:s \G\M\T');
  50 + $time = time();
50 $expiredTime = time() + 3600000; 51 $expiredTime = time() + 3600000;
51 $filePath = $path.'/'.$fileName; 52 $filePath = $path.'/'.$fileName;
52 $stringToSign = "{$httpVerb}\n{$contentMd5}\n{$contentType}\n{$date}\n/{$this->config['bucket']}/{$filePath}"; 53 $stringToSign = "{$httpVerb}\n{$contentMd5}\n{$contentType}\n{$date}\n/{$this->config['bucket']}/{$filePath}";
53 $sign = base64_encode(hash_hmac('sha1', $stringToSign, $this->config['secretKey'], true)); 54 $sign = base64_encode(hash_hmac('sha1', $stringToSign, $this->config['secretKey'], true));
54 $authorization = 55 $authorization =
55 - "q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$expiredTime}&q-key-time={$expiredTime}&q-header-list=&q-url-param-list=&q-signature={$sign}"; 56 + "q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={}&q-key-time={$expiredTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
56 $url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}"; 57 $url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}";
57 // 打开文件流 58 // 打开文件流
58 $filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName; 59 $filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName;