SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for magic_api_info
-- ----------------------------
DROP TABLE IF EXISTS `magic_api_info`;
CREATE TABLE `magic_api_info`  (
  `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `api_method` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方法',
  `api_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求路径',
  `api_script` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口脚本',
  `api_parameter` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口参数',
  `api_option` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口选项',
  `api_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接口名称',
  `api_group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接口分组',
  `api_group_prefix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分组前缀',
  `api_output` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '输出结果',
  `api_create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
  `api_update_time` bigint(20) NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'MagicAPI接口信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for magic_api_info_his
-- ----------------------------
CREATE TABLE `magic_api_info_his`  (
  `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'api_id',
  `api_method` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方法',
  `api_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求路径',
  `api_script` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口脚本',
  `api_parameter` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口参数',
  `api_option` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '接口选项',
  `api_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接口名称',
  `api_group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接口分组',
  `api_group_prefix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分组前缀',
  `api_output` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '输出结果',
  `api_create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
  `api_update_time` bigint(20) NULL DEFAULT NULL COMMENT '修改时间'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'MagicAPI接口历史记录' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of magic_api_info
-- ----------------------------
INSERT INTO `magic_api_info` VALUES ('033239e63a2a42b987567a37a2efdd32', 'GET', '/download', 'import response;\r\nreturn response.download(\'中文测试\',\'str.txt\');', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '文件下载', '自定义结果', '/custom', '', 1595050133467, 1595065447606);
INSERT INTO `magic_api_info` VALUES ('104219ceb2e34de38c1d4389cb0a094e', 'GET', '/json', 'import response;\r\nreturn response.json({\r\n    success : true,\r\n    message : \'执行成功\'\r\n});', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '自定义json', '自定义结果', '/custom', '{\n    \"success\": true,\n    \"message\": \"执行成功\"\n}', 1595065423867, 1595065447606);
INSERT INTO `magic_api_info` VALUES ('180524e850124de7956d855bc94bcac9', 'GET', '/if', '/*\r\n    if 测试\r\n*/\r\nif(a == 1){\r\n    return 1;\r\n}else if(a == 2){\r\n    return 2;\r\n}else{\r\n    return 0;\r\n}', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', 'if测试', '语法测试', '/test', NULL, 1593514724505, 1594736129503);
INSERT INTO `magic_api_info` VALUES ('343ac4fb280941a6bb7ddc523b331fee', 'GET', '/page', 'import response;\r\nvar total = 5;  //模拟一共有多少条数据\r\nvar list = [1,2];   //模拟数据项\r\nreturn response.page(total,list);', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '自定义分页', '自定义结果', '/custom', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 5,\n        \"list\": [\n            1,\n            2\n        ]\n    },\n    \"timestamp\": 1595065175380\n}', 1595065176504, 1595065447606);
INSERT INTO `magic_api_info` VALUES ('48095f19fa3a455296bf96b244a3c60c', 'GET', '/image', 'import \'java.awt.image.BufferedImage\' as BufferedImage;\r\nimport \'java.awt.Color\' as Color;\r\nimport \'java.awt.Font\' as Font;\r\nimport \'java.io.ByteArrayOutputStream\' as ByteArrayOutputStream;\r\nimport \'java.util.Random\' as Random;\r\nimport \'javax.imageio.ImageIO\' as ImageIO;\r\nimport response;\r\nimport log;\r\n\r\nvar width = 200;\r\nvar height = 69;\r\nvar image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);\r\nvar graphics = image.getGraphics();\r\ngraphics.setColor(Color.WHITE);\r\ngraphics.fillRect(0,0,width,height);\r\ngraphics.setFont(new Font(\"微软雅黑\", Font.BOLD, 40));\r\nvar letter = \'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ\';\r\nvar random = new Random();\r\nvar randomColor = ()=>new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256));\r\nvar x = 10;\r\nvar code = \'\';\r\nfor (i in range(0, 3)){ //验证码\r\n    graphics.setColor(randomColor());\r\n    var degree = random.nextInt() % 30;\r\n    var ch = letter.charAt(random.nextInt(letter.length()));\r\n    code = code + ch;\r\n    graphics.rotate(degree * 3.1415926535 / 180, x, 45);\r\n    graphics.drawString(ch + \'\', x, 45);\r\n    graphics.rotate(-degree * 3.1415926535 / 180, x, 45);\r\n    x = x + 48;\r\n}\r\nlog.info(\'生成的验证码:{}\',code)\r\nfor (i in range(0, 6)) {    //干扰线\r\n    graphics.setColor(randomColor());\r\n    graphics.drawLine(random.nextInt(width), random.nextInt(height),random.nextInt(width), random.nextInt(height));\r\n}\r\n\r\nfor(i in range(0, 30)){  //噪点\r\n    graphics.setColor(randomColor());\r\n    graphics.fillRect(random.nextInt(width), random.nextInt(height), 2,2);\r\n\r\n}\r\ngraphics.dispose();\r\nvar baos = new ByteArrayOutputStream();\r\nImageIO.write(image,\"png\",baos);\r\nbaos.flush();\r\nbaos.close();\r\nreturn response.image(baos.toByteArray(),\'image/png\');\r\n', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '生成验证码', '自定义结果', '/custom', '\"iVBORw0KGgoAAAANSUhEUgAAAMgAAABFCAIAAACAFD7PAAAElklEQVR42u3bTYhOYRQH8GmspyykxkKzMNSYMikpITa2CitNFpQyNVMWbEbNwkYNFnaTYqGUBZHFLAhTiiJFyWYsiCxmMRshpXF0dXu6H889z/fH/Z/+y/veIb/Oc54zr4E1FMpBDUT4Z7o6up+CfxvAAq9s69T9L5SsYIm8IAyw0MDC18/ZVUpER+GPm58oaGC9grVz8SKl77AgzHr5gJVigRduhWhggJVLA1t3ZKGMo5/4bHIPBZL8wVo9OlskYAPjqBpaOldEjxRg+YBVYhLj+a8kdqmSF+eDpbBOZyIpua2Z8fcUwMoH1pnLLygir84JbOndnMRZSa1RFWApw1Ii4hQWZ2AqHxBhMWf8Ciyxpg+MUSrOmLbyq+tfz+vD0iPS+ClzWyIpJiz5w2282mwVsCqM+EcnYFnoPbHBUlpSSJpW52jVH2dGsOw2LbvnYCnm0fwDimq7kjcwiS2ls69tRAOsHGBpLClswTK5dfYI1tS+f4kNlsZ01VkEq20C64SlRC1dYX2Hpf2ziqZVn8AkM1avLoaZH4UVOtZh1Wf8tg1W35YOYWAFaVoWVUlGeCavFK38GZyghIQV52noB1Zx5HU2sOQ8NcYhrCQuhhbH9k5YFUCNvDIg1Wkrf1gFIOuq6rYkB1+KXwXjqJLwyg1Wm6GwsMpGlRAvJVh1W72A1ZbOV02OHKfYtbWWwndZ5YDSg+XuNNSzZQKLsyyNVhiHjvwBV7Bim99N+pbqgchZljYKixmW6jMWYKU7ZtniZetXh/E0MObtT/JYj2C5s6UEi7NuCM6LuVMArAXmBOZiWVpm7ONEGc47w/LSOAp7DcuRLRGWCEhMWgvSeGesipLvU7cpATcO4gOblrdQDG21AbJyGrqrh+O3zG11XhvtwOIoqcBy/X91TGDVbXEAufv2n0VSclWqS9FgsCRWwsJqe4zZhPyM8J4blUVVTFtGsOpc+E+6g9UGqP6pV9uWKZ73Dp4blaGqtnfagSUXw0n5ntcLlyhWYDE7kORMdAfLjy3ORGWdVESwxPfoweJ0INV5X+OquPfJLkoMTYvTqCSq9DZbTmBp2zIH1DgGqfqwsndQguXOlvbVj79n9wpLw5Y5IMP53W5JTsN7c98ormExGxVzHRURLD6vRkyLpzdQlABFBUtiqwIrbKPSgLX18HpKgBnLyk6hgOV56eCtaTklpaEqVVjBi4npwtnNFD+2ImlUGrBUT8OcYTErUVi7f61QTFSZzFiuYK08/UxZQwk1+HI7xTMs8/fofa0PsALAcm1Le6LSW2UFXpCi/JyGFkl10tFeuwNWSrbsNipDW4CVCSx3pDR4cV61Y+ANBbDiheW0UWnYYr4HsKK25ZOU4X6BfxTOf7hByQjW8+H/SQGW50ZlvdKDdWzkJMWOMPfU9GwlTSrM8H7nyiFKYFgeqanCSr1RJQzL97lp7IxvKw9SWDd4amkVWDcWr1FybVT8AizTq0AnrOxJbRz6TQGsGPcOgIUCLByFsAVYPmv08TQFsAALsAALpyEKsAALsGAr0ro7PEMBLMACLJRKvT14goKjEJU5rL+mrI6dI4qKvwAAAABJRU5ErkJggg==\"', 1595051666872, 1595066035326);
INSERT INTO `magic_api_info` VALUES ('4cd4297dba064c888e571cffbb00d729', 'GET', '/assert', 'import assert;\r\nassert.notNull(message, 0, \'message 不能为null\');\r\nassert.regx(id,\'\\d+\', 0, \'id必须是数字\');\r\nreturn \'ok\';', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456a\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '参数验证', '其它测试', '/other', '{\n    \"code\": 0,\n    \"message\": \"id必须是数字\",\n    \"data\": null,\n    \"timestamp\": 1595065764237\n}', 1595065796210, 1595065959708);
INSERT INTO `magic_api_info` VALUES ('523c2ae2b50a4465a0d8de83e5436da9', 'GET', '/map', 'var list = [{\r\n    sex : 0,\r\n    name : \'小明\',\r\n    age : 19\r\n},{\r\n    sex : 1,\r\n    name : \'小花\',\r\n    age : 18\r\n}];\r\n\r\nvar getAge = (age)=>{\r\n    return age > 18 ? \'成人\' : \'未成年\'\r\n}\r\n// 利用map函数对list进行过滤\r\nreturn list.map((item)=>{\r\n    age : getAge(item.age),\r\n    sex : item.sex == 0 ? \'男\' : \'女\',\r\n    name : item.name\r\n});', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '字段转换', '结果转换', '/convert', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"sex\": \"男\",\n            \"name\": \"小明\",\n            \"age\": \"成人\"\n        },\n        {\n            \"sex\": \"女\",\n            \"name\": \"小花\",\n            \"age\": \"未成年\"\n        }\n    ],\n    \"timestamp\": 1595066113546\n}', 1595066116077, 1595066227461);
INSERT INTO `magic_api_info` VALUES ('6cf9a1ad659f4707be704528632778c5', 'GET', '/loop/map', '/*\r\n    测试循环Map\r\n*/\r\nvar map = {\r\n    key1 : 1,\r\n    key2 : 2,\r\n    key3 : 3\r\n};\r\nvar sum = 0;\r\nvar keys = \'\';\r\nfor(key,value in map){\r\n    sum = sum + value;\r\n    keys = keys + key\r\n}\r\nreturn keys + \'-\' + sum;', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试循环Map', '语法测试', '/test', NULL, 1593515248339, 1594736134584);
INSERT INTO `magic_api_info` VALUES ('7557a409802b4742b590122ef030b643', 'GET', '/expression', 'var ids = [\'1\',\'2\',\'3\'];\r\n\r\n//具体执行的SQL请看打印的运行日志信息。\r\n\r\ndb.select(\'select * from magic_api_info where id in (#{ids})\')  //对参数自动展开\r\n\r\nvar id = \'123\';\r\ndb.select(\"select * from magic_api_info where id = \'${id}\' \")  //拼接字符串的方式\r\n\r\n\r\n//var name = \'123\';\r\ndb.select(\"select * from magic_api_info where id = \'123\' ?{name,and api_name = #{name}}\")  //if 判断\r\n\r\nreturn \'ok\';', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '参数测试', 'SQL测试', '/sql', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": \"ok\",\n    \"timestamp\": 1595066664099\n}', 1595066679177, 1595066679177);
INSERT INTO `magic_api_info` VALUES ('8621986dbb6945c6bd8a01dbcecfe9a5', 'GET', '/filter-map', 'var list = [{\r\n    sex : 0,\r\n    name : \'小明\'\r\n},{\r\n    sex : 1,\r\n    name : \'小花\'\r\n}]\r\n// 利用map函数对list进行过滤，然后进行转换\r\nreturn list.filter(item=>item.sex == 0).map((item)=>{\r\n    sex : item.sex == 0 ? \'男\' : \'女\',\r\n    name : item.name\r\n});', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '过滤和转换', '结果转换', '/convert', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"sex\": \"男\",\n            \"name\": \"小明\"\n        }\n    ],\n    \"timestamp\": 1595066270905\n}', 1595066278706, 1595066278706);
INSERT INTO `magic_api_info` VALUES ('9815c54b31f64a9cb3a068934df21c25', 'POST', '/var', '/*\r\n    测试变量定义\r\n*/\r\nvar int = 1; \r\nvar double = 2.0d; //2.0D \r\nvar long =  3L; // 3l\r\nvar float =  4f; // 4F\r\nvar byte =  5b; // 5B;\r\nvar short = 6s; //6S\r\nvar boolean = true; //true or false;\r\nvar nullValue = null; // null\r\nvar list = [1,2,3,4,5]; //定义list\r\nvar map = {\r\n    k1 : 123,\r\n    k2 : \"456\",\r\n    k3 : 789L,\r\n    k4 : {\r\n        k5 : \'...\'\r\n    }\r\n};  //定义map\r\nvar string1 = \"str\";    //定义字符串\r\nvar string2 = \'str2\'; // \\t \\n \\r \\\' \\\" \\\\ 转义符是支持的，其它的不支持\r\n//文本块，主要用于定义SQL\r\nvar string3 = \"\"\"  \r\n    select \r\n        * \r\n    from table t1\r\n    join table2 t2 on t2.xx = t1.xx\r\n    where t1.id in (1,2,3,4,5,6)\r\n\"\"\"\r\n\r\nvar lambda = e=>e+1;    //定义lambda', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试定义变量', '语法测试', '/test', NULL, 1593519576351, 1594736110904);
INSERT INTO `magic_api_info` VALUES ('986acacbb7a84ea58c2ceff7e74e04b5', 'GET', '/log', 'import log;\r\n// 切换到\"运行日志\"查看日志信息\r\nlog.info(\'info日志:{}\',message);\r\nlog.warn(\'warn日志\');\r\ntry{\r\n    return 1 / 0;\r\n}catch(e){\r\n    log.error(\'error日志\',e);\r\n}\r\nreturn \'ok\';', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试日志', '其它测试', '/other', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": \"ok\",\n    \"timestamp\": 1595065936684\n}', 1595065953402, 1595065959708);
INSERT INTO `magic_api_info` VALUES ('998b865018a146aab9abd8f4ffdc8359', 'GET', '/cache', 'return db.cache(\'test\').select(\'select api_name,api_method,api_path from magic_api_info\');', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '缓存测试', 'SQL测试', '/sql', '', 1595064750136, 1595064750136);
INSERT INTO `magic_api_info` VALUES ('a4ebe5b3b0a143e797e0027e37b089d3', 'GET', '/page', 'return db.page(\'select api_name from magic_api_info\')', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '分页测试', 'SQL测试', '/sql', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 12,\n        \"list\": [\n            {\n                \"apiName\": \"文件下载\"\n            },\n            {\n                \"apiName\": \"if测试\"\n            },\n            {\n                \"apiName\": \"生成验证码\"\n            },\n            {\n                \"apiName\": \"测试循环Map\"\n            },\n            {\n                \"apiName\": \"测试定义变量\"\n            },\n            {\n                \"apiName\": \"缓存测试\"\n            },\n            {\n                \"apiName\": \"操作符测试\"\n            },\n            {\n                \"apiName\": \"测试循环List\"\n            },\n            {\n                \"apiName\": \"测试lambda\"\n            },\n            {\n                \"apiName\": \"测试创建对象\"\n            }\n        ]\n    },\n    \"timestamp\": 1595064916305\n}', 1595064929177, 1595064929177);
INSERT INTO `magic_api_info` VALUES ('b7df52ff308e481abceda07d7d3ef62c', 'GET', '/binary', '/*\r\n    各种操作符测试\r\n*/\r\nimport \'java.lang.System\' as system;\r\nvar a = 1;\r\nvar b = 2;\r\nsystem.out.println(\"a = \" + a + \", b = \" + b);\r\nvar c = a + b;\r\nsystem.out.println(\"a + b = \" + c);\r\nc = a - b;\r\nsystem.out.println(\"a - b = \" + c);\r\nc = a * b;\r\nsystem.out.println(\"a * b = \" + c);\r\nc = a / b;\r\nsystem.out.println(\"a / b = \" + c);\r\nc = a % b;\r\nsystem.out.println(\"a % b = \" + c);\r\nc = a > b;\r\nsystem.out.println(\"a > b = \" + c);\r\nc = a >= b;\r\nsystem.out.println(\"a >= b = \" + c);\r\nc = a == b;\r\nsystem.out.println(\"a == b = \" + c);\r\nc = a < b;\r\nsystem.out.println(\"a < b = \" + c);\r\nc = a <= b;\r\nsystem.out.println(\"a <= b = \" + c);\r\nc = a != b;\r\nsystem.out.println(\"a != b = \" + c);', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '操作符测试', '语法测试', '/test', NULL, 1593514691506, 1594903771663);
INSERT INTO `magic_api_info` VALUES ('cd3c9e4c09fc44fdb82c0f1b783f59af', 'GET', '/loop/list', '/*\r\n    测试循环List\r\n*/\r\nvar list = [1,2,3,4,5];\r\nvar sum = 0;\r\nfor(val in list){\r\n    sum = sum + val;\r\n}\r\nreturn sum;', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试循环List', '语法测试', '/test', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": 15,\n    \"timestamp\": 1594915393436\n}', 1593515155753, 1594915394105);
INSERT INTO `magic_api_info` VALUES ('d338de01930f4149b4ea85c9f1f88387', 'GET', '/lambda', '/*\r\n    测试Lambda\r\n*/\r\nvar lambda1 = e => e + 1; //单参数单行代码，省略括号,省略{}\r\nvar lambda2 = (e) => e +1; //单参数单行代码，不省略括号，省略{} 作用同上\r\nvar lambda4 = e => {e + 1};//单参数无返回值，不能省略{}\r\nvar lambda5 = e => {return e + 1};//单参数有返回值，省略括号,不省略{}\r\nvar lambda6 = (e) => {return e + 1};//单参数有返回值，不省略括号,不省略{}，作用同上\r\nvar lambda7 = (a,b) => a + b; //多参数单行代码，省略{}\r\nvar lambda7 = (a,b) => {return a + b}; //多参数单行代码，有返回值，作用同上\r\nvar lambda8 = (a,b) =>{ //多参数多行代码， 无法省略括号和{}\r\n    a = a + 1;\r\n    return a + b;\r\n}\r\nvar v1 = lambda1(1);    //返回2\r\nvar v2 = lambda2(v1);    //返回3\r\nreturn lambda8(v1,lambda7(v1,v2)); //返回8\r\n', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试lambda', '语法测试', '/test', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": 8,\n    \"timestamp\": 1594915477773\n}', 1593518831250, 1594915478585);
INSERT INTO `magic_api_info` VALUES ('dafa5ca6daf9419995e9a4a01eea1e57', 'GET', '/filter', 'var list = [{\r\n    sex : 0,\r\n    name : \'小明\'\r\n},{\r\n    sex : 1,\r\n    name : \'小花\'\r\n}]\r\n// 利用map函数对list进行过滤\r\nreturn list.filter((item)=>item.sex == 0);', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"body\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', 'List过滤', '结果转换', '/convert', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"sex\": 0,\n            \"name\": \"小明\"\n        }\n    ],\n    \"timestamp\": 1595066209866\n}', 1595066211481, 1595066227461);
INSERT INTO `magic_api_info` VALUES ('dccb42bc1d974d99b0ebd9a12d42c47b', 'GET', '/new', 'import \'java.util.Date\' as Date;\r\nimport \'java.text.SimpleDateFormat\' as SimpleDateFormat;\r\nvar now = new Date();\r\nvar df = new SimpleDateFormat(\'yyyy-MM-dd\');\r\nreturn df.format(now);', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试创建对象', '语法测试', '/test', '{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": \"2020-07-18\",\n    \"timestamp\": 1595040221517\n}', 1593525594254, 1595040241898);
INSERT INTO `magic_api_info` VALUES ('ee45724999ad400c927f5a267f6b8676', 'GET', '/test/for', '/*\r\n    测试循环\r\n*/\r\nvar sum = 0;\r\nfor(val in range(0,100)){   //包括0 包括100\r\n    if(val > 90){\r\n        break;  //跳出循环\r\n    }\r\n    if(val % 3 == 0){\r\n        continue;   //进入下一次循环\r\n    }\r\n    sum = sum + val;\r\n}\r\nreturn sum;', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试for循环', '语法测试', '/test', NULL, 1593515005267, 1594735986968);
INSERT INTO `magic_api_info` VALUES ('ff2135698c6e4d1bad0db59195dfe706', 'GET', '/select', 'var sql = \"\"\"\r\n    select \r\n        \'${message}\' as user_name,\r\n        #{id} as user_id\r\n\"\"\";\r\nreturn db.select(sql);', '{\r\n	\"request\" : {\r\n		\"message\" : \"Hello MagicAPI!\"\r\n	},\r\n	\"path\" : {\r\n		\"id\" : \"123456\"\r\n	},\r\n	\"header\" : {\r\n		\"token\" : \"tokenValue\"\r\n	},\r\n	\"cookie\" : {\r\n		\"cookieName\" : \"cookieValue\"\r\n	},\r\n	\"session\" : {\r\n		\"userId\" : \"123\"\r\n	}\r\n}', '{\r\n}', '测试执行SQL', 'SQL测试', '/sql', '', 1593005960511, 1594990967188);


SET FOREIGN_KEY_CHECKS = 1;
