public static function notifyAdmin($msg, $op_user, $all = TRUE) { $user_info = self::getAdmins(); foreach ($user_info as $name => $info) { NotifyUtil::notifyByQHEmail($info["QHE"], $msg, $msg, $op_user); if ($all) { NotifyUtil::notifyBySMS($info["SMS"], $msg); } } }
public function rejectNodeAction() { $this->setNoViewRender(true); // $perm_id = isset($_POST['perm_id']) ? $_POST['perm_id'] : ""; $perm_id = $this->getRequest("perm_id", ""); $admin_user = $this->userInfo["userName"]; $sub_buss_id = "NULL"; // 2. parameter is not right if ($perm_id === "") { $res = InfoDescUtil::getErrorMsg(InfoDescUtil::ERR_BAD_ARGS); QconfMgrLog::err(__FILE__, __LINE__, "parameter 'perm_id' is null!"); echo json_encode($res); return; } // 3. get the perm_id value failed $res = PermServ::selectById($perm_id); if ($res === FALSE) { $res = InfoDescUtil::getErrorMsg(InfoDescUtil::ERR_MYSQL_FAIL); QconfMgrLog::err(__FILE__, __LINE__, "get the value of perm_id '{$perm_id}' failed!"); echo json_encode($res); return; } $main_buss_id = $res["main_buss_id"]; $op_user_email = $res["apply_user_email"]; $node = $res["node"]; $idc = $res["idc"]; $apply_status_code = $res["apply_status_code"]; if (intval($apply_status_code) !== intval(InfoDescUtil::APPLY_STATUS_EXAMINE)) { $res = InfoDescUtil::getErrorMsg(InfoDescUtil::ERR_NODE_EXIST); QconfMgrLog::err(__FILE__, __LINE__, "{$node} has already been deal with!"); echo json_encode($res); return; } $ret = PermServ::modPerm($perm_id, InfoDescUtil::APPLY_STATUS_NOT_PASS); // 4. update the apply staus failed if ($ret === FALSE) { $res = InfoDescUtil::getErrorMsg(InfoDescUtil::ERR_MYSQL_FAIL); QconfMgrLog::err(__FILE__, __LINE__, "update the apply stats in qconf_perm failed!"); echo json_encode($res); return; } OpServ::insert(InfoDescUtil::OP_TYPE_AUDIT_REJECT, $qconf_path, $idc, InfoDescUtil::OP_STATUS_SUCCESS, $main_buss_id, $sub_buss_id, $op_user, ""); // 5. return the data $res = array("errno" => "0", "errmsg" => "", "data" => ""); NotifyUtil::notifyByQHEmail($op_user_email, "node: '{$node}' apply on '{$idc}' has been REJECTED", " 在机房 {$idc} 申请的根节点 {$node} 被拒绝! ", $admin_user); $json = json_encode($res); echo $json; }