未验证 提交 06db4a70 编写于 作者: Q qkqpttgf 提交者: GitHub

get disk space size

上级 31182227
...@@ -813,4 +813,19 @@ class Aliyundrive { ...@@ -813,4 +813,19 @@ class Aliyundrive {
} }
return true; return true;
} }
public function getDiskSpace() {
if (!($diskSpace = getcache('diskSpace', $this->disktag))) {
$url = $this->api_url . '/databox/get_personal_info';
$header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token;
$response = curl('POST', $url, '', $header);
//error_log1(json_encode($response));
$res = json_decode($response['body'], true)['personal_space_info'];
$used = size_format($res['used_size']);
$total = size_format($res['total_size']);
$diskSpace = $used . ' / ' . $total;
savecache('diskSpace', $diskSpace, $this->disktag);
}
return $diskSpace;
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册