Skip to content

Conversation

ankadada
Copy link
Contributor

No description provided.

$this->iovipHost = $iovipHost;
}

//华东机房
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return array(null, new Error($url, $ret));
}
$r = ($ret->body === null) ? array() : $ret->json();
//print_r($ret);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

测试代码

@@ -0,0 +1,20 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件名 改成 delete_bucket.php 吧,
rs 概念不对外暴露,增加客户负担。
下同。

@@ -0,0 +1,24 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件名 同上


const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改

const RSF_HOST = 'rsf.qiniu.com';
const API_HOST = 'api.qiniu.com';
const RS_HOST = 'rs.qiniu.com'; //RS Host
const UC_HOST = 'https://api.qiniu.com'; //UC Host
const UC_HOST = 'uc.qbox.me'; //UC Host
const RTCAPI_HOST = 'http://rtc.qiniuapi.com';
const ARGUS_HOST = 'argus.atlab.ai';
const RTCAPI_VERSION = 'v3';

// Zone 空间对应的机房
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Zone 空间对应的机房 ==》 // Zone 空间对应的存储区域

/*
* GET /v2/query?ak=<ak>&&bucket=<bucket>
**/
public static function queryZone($ak, $bucket)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queryZone —> queryRegion ?

@rwifeng
Copy link
Contributor

rwifeng commented Mar 5, 2019

Travis 没有过


public function listbuckets(
$region = null,
$global = 'false',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$global 废弃了把。

* fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。
* @return string[] 包含空间信息
*/
public function bucketInfos($region = null, $global = 'false', $shared = 'false', $fs = 'false')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上 $global 废弃了。

* 主备源会分开计算.
* Backup 是否备用回源,回源优先尝试主源
*/
public function putBucktSourceConfig($params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array的参数还是限制下吧:
public function putBucktSourceConfig($params Array)
另外把 key 都注释清楚。

/**
* 获取空间回源配置
*/
public function getBucktSourceConfig($params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

* allowed_credentials:该配置不支持设置,默认为true。
* 备注:如果没有设置任何corsRules,那么默认允许所有的跨域请求
*/
public function putCorsRules($bucket, $params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 如果我只看函数和备注的话,不清楚怎么过使用这个函数。
    看了文档才明白:https://github.com/qbox/product/blob/dc594b8f5b7745337efbf67656702ef9429bf910/kodo/bucket/uc.md#corsrulesset-%E8%AE%BE%E7%BD%AEbucket%E7%9A%84cors%E8%B7%A8%E5%9F%9F%E8%A7%84%E5%88%99
    Body:
    [
    {
    "allowed_origin": ["http://www.test1.com"],
    "allowed_method": ["GET", "POST"],
    },
    {
    "allowed_origin": ["http://www.test2.com"],
    "allowed_method": ["GET", "POST", "HEAD"],
    "allowed_header": ["testheader", "Content-Type"],
    "exposed_header": ["test1", "test2"],
    "max_age": 20
    }
    ]

所以 a. 修改下注释。 b. 这个一次只允许设置一条规则,函数比较清晰,设置参数就是:
{
"allowed_origin": ["http://www.test2.com"],
"allowed_method": ["GET", "POST", "HEAD"],
"allowed_header": ["testheader", "Content-Type"],
"exposed_header": ["test1", "test2"],
"max_age": 20
}

  1. 参数最好加上类型 (其他新加的函数都可以添加上)
    public function putCorsRules(string $bucket, Array $params)

* 主备源会分开计算.
* Backup 是否备用回源,回源优先尝试主源
*/
public function putBucktSourceConfig(array $params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同 putCorsRules

return $this->postV2($url, $body);
}

private function postV2($url, $body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个删掉吧, 可读性不好。
把 private function post($url, $body)
改成: private function post($url, $body, $contentType = 'application/x-www-form-urlencoded')

@@ -407,6 +1005,24 @@ private function post($url, $body)
return array($r, null);
}

private function ucPostV2($path, $body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也删掉吧, 合并成一个。

@rwifeng rwifeng merged commit 2545e45 into qiniu:master May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants