作者 lyh

gx

@@ -79,15 +79,16 @@ class TencentCosService extends BaseService @@ -79,15 +79,16 @@ class TencentCosService extends BaseService
79 $httpHeaders = rtrim($httpHeaders, "&"); 79 $httpHeaders = rtrim($httpHeaders, "&");
80 //生成HttpString 80 //生成HttpString
81 $httpMethod = Str::lower($httpVerb); 81 $httpMethod = Str::lower($httpVerb);
82 - $uriPathname = $path.'/'.$fileName; 82 + $uriPathname = \request()->getPathInfo();
83 $httpString = $httpMethod . "\n" . $uriPathname . "\n" . $httpParameters . "\n" . $httpHeaders . "\n"; 83 $httpString = $httpMethod . "\n" . $uriPathname . "\n" . $httpParameters . "\n" . $httpHeaders . "\n";
84 //生成 StringToSign 84 //生成 StringToSign
85 $sha1String = sha1($httpString); 85 $sha1String = sha1($httpString);
86 $stringToSign = "sha1\n" . $keyTime . "\n" . $sha1String . "\n"; 86 $stringToSign = "sha1\n" . $keyTime . "\n" . $sha1String . "\n";
  87 + $filePath = $path.'/'.$fileName;
87 $sign = hash_hmac( 'sha1', $stringToSign, $signKey ); 88 $sign = hash_hmac( 'sha1', $stringToSign, $signKey );
88 $authorization = 89 $authorization =
89 "q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$keyTime}&q-key-time={$keyTime}&q-header-list=&q-url-param-list=&q-signature={$sign}"; 90 "q-sign-algorithm=sha1&q-ak={$this->config['secretId']}&q-sign-time={$keyTime}&q-key-time={$keyTime}&q-header-list=&q-url-param-list=&q-signature={$sign}";
90 - $url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$uriPathname}"; 91 + $url = "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com{$filePath}";
91 // 打开文件流 92 // 打开文件流
92 $filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName; 93 $filePathUrl = config('filesystems.disks.upload')['root'].$path.'/'.$fileName;
93 return $this->http_put($url,$contentType,$authorization,$date,$filePathUrl); 94 return $this->http_put($url,$contentType,$authorization,$date,$filePathUrl);
@@ -128,8 +129,6 @@ class TencentCosService extends BaseService @@ -128,8 +129,6 @@ class TencentCosService extends BaseService
128 curl_close($ch); 129 curl_close($ch);
129 // 检查响应结果 130 // 检查响应结果
130 if ($response) { 131 if ($response) {
131 - var_dump($response);  
132 - die();  
133 return 1; 132 return 1;
134 } else { 133 } else {
135 return 0; 134 return 0;