diff --git a/config/cloud.php b/config/cloud.php index d480275..9d5f085 100644 --- a/config/cloud.php +++ b/config/cloud.php @@ -14,15 +14,15 @@ return [ // 又拍驱动 'uppay' => \thinking\icloud\cloud\UpYunCloud::class, // 七牛驱动认证 - 'qinniuAuth' => \thinking\icloud\auth\QiniuAuth::class, + 'qiniuAuth' => \thinking\icloud\auth\QiNiuAuth::class, // 又拍驱动认证 - 'uppay' => \thinking\icloud\auth\UpYunAuth::class, + 'uppayAuth' => \thinking\icloud\auth\UpYunAuth::class, ], /* 七牛配置信息 */ 'qiniu' => [ - 'app_key' => '', - 'app_secret' => '', + 'app_key' => 'dw1jkmtSNjxyPkMdyBfVeaWzCAOiMSOTk35adV8W', + 'app_secret' => '_KfsmnV8d-rlYtABD27xF7y-ZNxblvdk9_VVZ67g', //上传策略字段,上传凭证校验使用 'policyFields' => [ @@ -56,11 +56,14 @@ return [ 'buckets' => [''], ], - + 'oss' => [ + 'access_key' => '', + 'access_secret' => '', + ], //api接口 'host' => [ //七牛host - 'rs' => 'rs.qiniu.com', + 'rs' => 'rs.qbox.me', 'api' => 'api.qiniu.com', 'uc' => 'uc.qbox.me', 'rsf' => 'rsf.qbox.me', diff --git a/extend/icloud/src/AbstractCloud.php b/extend/icloud/src/AbstractCloud.php index d577816..c9df72d 100644 --- a/extend/icloud/src/AbstractCloud.php +++ b/extend/icloud/src/AbstractCloud.php @@ -7,9 +7,10 @@ */ namespace thinking\icloud; -use thinking\icloud\auth\AuthFactory; -use thinking\icloud\Utility; +use thinking\icloud\factory\AuthFactory; +use thinking\icloud\httpclient\Client; use thinking\icloud\exception\NotFoundException; +use thinking\icloud\Utility; class AbstractCloud { @@ -40,7 +41,6 @@ class AbstractCloud if (!array_key_exists($host, $this->host)) { throw NotFoundException::NotFoundKey("Host Key '{$host}' Not Found In Config File"); } - return self::getHost($host, $isHttps); } @@ -61,16 +61,14 @@ class AbstractCloud { // TODO: Implement __call() method. $client = new Client; - $client->url = $arguments[0]; - $this->method = $name; - + $client->uri = $arguments[0]; + $client->method = $name; if (isset($arguments[1]['headers']['Authorization'])) { $client->params = $arguments[1]; } else { $headers = AuthFactory::authorization($arguments[0], $name); - $client->params = array_merge_recursive(['headers' => $headers], $arguments[1]); + $client->params = array_merge_recursive(['headers' => $headers], $arguments[1] ?? []); } - return $client->send(); } diff --git a/extend/icloud/src/Utility.php b/extend/icloud/src/Utility.php index ac5a8ce..9100732 100644 --- a/extend/icloud/src/Utility.php +++ b/extend/icloud/src/Utility.php @@ -32,7 +32,7 @@ trait Utility */ public static function getHost(string $host = 'rs', bool $isHttps = false) { - return $isHttps ? 'https://' : 'http://' . config('icloud.host.'. strtolower($host)); + return $isHttps ? 'https://' : 'http://' . config('cloud.host.'. strtolower($host)); } /** diff --git a/extend/icloud/src/auth/OssAuth.php b/extend/icloud/src/auth/OssAuth.php new file mode 100644 index 0000000..52bae47 --- /dev/null +++ b/extend/icloud/src/auth/OssAuth.php @@ -0,0 +1,17 @@ +