mirror of
https://github.com/newnius/YAO-portal.git
synced 2025-06-06 07:11:54 +00:00
support update conf
This commit is contained in:
parent
258fbf48ba
commit
8b54b46d25
10
ajax.php
10
ajax.php
@ -240,6 +240,16 @@ switch ($action) {
|
||||
$res = debug_get_bindings();
|
||||
break;
|
||||
|
||||
case 'conf_update':
|
||||
$option = cr_get_POST('option', '');
|
||||
$value = cr_get_POST('value', '');
|
||||
$res = conf_update($option, $value);
|
||||
break;
|
||||
|
||||
case 'conf_list':
|
||||
$res = conf_list();
|
||||
break;
|
||||
|
||||
case 'user_signout':
|
||||
$res = user_signout();
|
||||
break;
|
||||
|
@ -336,3 +336,46 @@ function job_describe(CRObject $rule)
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
function conf_update($option, $value)
|
||||
{
|
||||
if (!AccessController::hasAccess(Session::get('role', 'visitor'), 'job.list')) {
|
||||
$res['errno'] = Code::NO_PRIVILEGE;
|
||||
return $res;
|
||||
}
|
||||
|
||||
$spider = new Spider();
|
||||
$spider->doGet(YAO_SCHEDULER_ADDR . '?action=update_conf&option=' . $option . '&value=' . $value);
|
||||
$msg = json_decode($spider->getBody(), true);
|
||||
|
||||
if ($msg['code'] !== 0) {
|
||||
$res['errno'] = $msg['code'];
|
||||
$res['msg'] = $msg['error'];
|
||||
return $res;
|
||||
}
|
||||
|
||||
$res['errno'] = Code::SUCCESS;
|
||||
return $res;
|
||||
}
|
||||
|
||||
function conf_list()
|
||||
{
|
||||
if (!AccessController::hasAccess(Session::get('role', 'visitor'), 'job.list')) {
|
||||
$res['errno'] = Code::NO_PRIVILEGE;
|
||||
return $res;
|
||||
}
|
||||
|
||||
$spider = new Spider();
|
||||
$spider->doGet(YAO_SCHEDULER_ADDR . '?action=conf_list');
|
||||
$msg = json_decode($spider->getBody(), true);
|
||||
|
||||
if ($msg['code'] !== 0) {
|
||||
$res['errno'] = $msg['code'];
|
||||
$res['msg'] = $msg['error'];
|
||||
return $res;
|
||||
}
|
||||
|
||||
$res['errno'] = Code::SUCCESS;
|
||||
$res['options'] = $msg['options'];
|
||||
return $res;
|
||||
}
|
Loading…
Reference in New Issue
Block a user