\User\UserLV::ADMIN_SUPER), $userData)) { $msg = "数据异常!"; \Logging\LogError($msg); return; } if (isset($userData)) { $msg = "已经存在超级管理员账号,不能重复创建!"; \Logging\LogError($msg); return true; } $Psw = \Commfunc\GetEncodePsw($Psw); if (!$Psw) { $msg = "密码异常!"; \Logging\LogError($msg); return; } $OrganizationList = \CommFunc\GetAllOrganization(); if (!isset($OrganizationList) || count($OrganizationList) < 0) { $msg = "没有配置组织!"; \Logging\LogError($msg); return; } if (!\DBOper\Insert("GMTUser", array( "UserAccount" => $UserAccount, "Psw" => $Psw, "UserLV" => \User\UserLV::ADMIN_SUPER, "Organization" => $OrganizationList[0], #超管默认属于第一个组织 "CreateTime" => date("Y-m-d H:i:s") ))) { $msg = "创建失败!"; \Logging\LogError($msg); return; } \Logging\LogInfo("创建成功!" . $UserAccount); return 1; } \Logging\CreateLogging("account.super.php"); \Logging\LogInfo("_POST: " . print_r($_POST, true)); $msg = ""; $ok = 0; if (array_key_exists('UserAccount', $_POST)) { $ok = CreateSuperAdmin(); } else { if (\DBOper\FindOne("GMTUser", array("UserLV" => \User\UserLV::ADMIN_SUPER), $userData) && isset($userData)) { $ok = 2; $msg = "已经存在超级管理员账号,不用创建!"; \Logging\LogError($msg); } } if ($msg) { echo ""; } // echo $ok; if ($ok > 0) { header("Location:/Account/login.php?superok=" . $ok); exit; } ?>