public function getList()
{
$size = $this->request->get('size', $this->listSize);
$start = $this->request->get('start', '');
$auth = new Auth(config('ueditor.core.qiniu.accessKey'), config('ueditor.core.qiniu.secretKey'));
$bucketManager = new BucketManager($auth);
list($items, $marker, $error) = $bucketManager->listFiles(config('ueditor.core.qiniu.bucket'), $this->path, $start, $size);
if ($error) {
return ["state" => $error->message(), "list" => array(), "start" => $start, "total" => 0];
}
if (empty($items)) {
return ["state" => "no match file", "list" => array(), "start" => $start, "total" => 0];
}
$files = [];
foreach ($items as $v) {
if (preg_match("/\\.(" . $this->allowFiles . ")\$/i", $v['key'])) {
$files[] = array('url' => rtrim(config('ueditor.core.qiniu.url'), '/') . '/' . $v['key'], 'mtime' => $v['mimeType']);
}
}
if (empty($files)) {
return ["state" => "no match file", "list" => array(), "start" => $start, "total" => 0];
}
/* 返回数据 */
$result = ["state" => "SUCCESS", "list" => $files, "start" => $start, "total" => count($files)];
return $result;
}