1
0
mirror of https://github.com/newnius/YAO-portal.git synced 2025-12-13 00:56:44 +00:00
This commit is contained in:
2019-04-23 16:57:15 +08:00
parent dbfe0c5bb7
commit 75657a7d6d
18 changed files with 396 additions and 123 deletions

View File

@@ -63,3 +63,24 @@ function agent_list(CRObject $rule)
$res['errno'] = $res['agents'] === null ? Code::FAIL : Code::SUCCESS;
return $res;
}
function resource_list()
{
if (!AccessController::hasAccess(Session::get('role', 'visitor'), 'system.summary')) {
$res['errno'] = Code::NO_PRIVILEGE;
return $res;
}
$spider = new Spider();
$spider->doGet(YAO_SCHEDULER_ADDR . '?action=resource_list');
$msg = json_decode($spider->getBody(), true);
if ($msg['code'] !== 0) {
$res['errno'] = $msg['code'] !== null ? $msg['code'] : Code::UNKNOWN_ERROR;
$res['msg'] = $msg['error'];
return $res;
}
$res['resources'] = $msg['resources'];
$res['errno'] = Code::SUCCESS;
return $res;
}