die(json_encode($res)); } $db = new MySQL($log); $mysqli = $db->openDB(); if ($mysqli == null) { $res["reason"] = "数据库连接失败"; die(json_encode($res)); } $invitation = new Invitation($mysqli, $log); if ($action == "del") { if ($_SESSION['user_info']['type'] == 1) { if ($ids == null || count($ids) < 0) { $res["reason"] = "无数据!"; } else { foreach ($ids as $id) { if ($invitation->delInvitation($id)) { $res["result"] = true; $res["reason"] = "删除记录成功!"; } else { $res["reason"] = "删除记录ID:" . $id . "失败!"; break; } } } } else { $res["reason"] = "你没有权限!"; } } else { if ($action == "new") { if ($_SESSION['user_info']['type'] == 1) { $key = $invitation->genInvitationCode($_SESSION['user_info']['id']);