| | |
| | | </Reference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Content Include="api.html" /> |
| | | <Content Include="DLL\log4net4.dll" /> |
| | | <Content Include="DLL\Mono.Security.dll" /> |
| | | <Content Include="DLL\Npgsql.dll" /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html xmlns="http://www.w3.org/1999/xhtml"> |
| | | <head> |
| | | <title>APIæ¥å£</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script src="js/rsa.min.js"></script> |
| | | <script src="js/rollups.js"></script> |
| | | <script> |
| | | var app = {}; |
| | | var path = "20221128010101"; |
| | | var url = "http://127.0.0.1:12316/server/"; |
| | | var token = "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567"; |
| | | |
| | | $(function () { |
| | | $("#pathSpan").html(path); |
| | | $("#tokenSpan").html(token); |
| | | getPublicKey(); |
| | | }); |
| | | |
| | | // Ajax |
| | | function ajax(url, type, data, dataType, contentType, fn) { |
| | | $.ajax({ |
| | | url: url, |
| | | type: type, |
| | | data: data, |
| | | dataType: dataType || "json", |
| | | contentType: contentType || "application/json", |
| | | success: function (data) { |
| | | fn(data); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | fn(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åURL |
| | | function getUrl(method) { |
| | | return url + method + "?token=" + token; |
| | | } |
| | | </script> |
| | | <script> |
| | | // è·åå
¬é¥ |
| | | function getPublicKey() { |
| | | $.get("http://127.0.0.1:12316/server/sign/getPublicKey", function (rs) { |
| | | if (rs && rs.code == 200) { |
| | | window.encrypt = new JSEncrypt(); |
| | | encrypt.setPublicKey(rs.result); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // ç»å½ |
| | | function login() { |
| | | var data = { |
| | | "uid": encrypt.encrypt("admin"), // ç¨æ·åï¼RSAå å¯ |
| | | "pwd": encrypt.encrypt("Admin@1234_lf") // å¯ç ï¼RSAå å¯ |
| | | }; |
| | | |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/sign/login", |
| | | type: "POST", |
| | | data: JSON.stringify(data), |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | if (!rs || rs.code != 200) { |
| | | $("ç»å½å¤±è´¥ï¼\n" + rs.msg); |
| | | return; |
| | | } |
| | | |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // ç»åº1ï¼ä»¤çæ¾headerä¸ |
| | | function logout1() { |
| | | $.ajax({ |
| | | headers: { |
| | | token: "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" |
| | | }, |
| | | url: "http://127.0.0.1:12316/server/sign/logout", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // ç»åº1ï¼ä»¤çæ¾urlä¸ |
| | | function logout2() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/sign/logout?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // æ£æ¥æ¯/å¦ç»å½ |
| | | function check() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/sign/check?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // æ¯/å¦ä¸ºç®¡çå |
| | | function isAdmin() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectForIsAdmin?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®æ°æ®åºIDè·åç¨æ· |
| | | function getUserById() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectUser?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&id=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®ç»å½IDè·åç¨æ· |
| | | function getUserByUid() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectByUid?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&uid=admin", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åç¨æ·å表 |
| | | function selectUsers() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectByPageAndCount?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&uname=&pageSize=10&pageIndex=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // æ¯/å¦ä¸ºç®¡çå |
| | | function isAdmin2() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectIsAdmin?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&id=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·å管çåç¨æ· |
| | | function selectAdminUsers() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectAdminUsers?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&type=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åç¨æ·çè§è²ä¿¡æ¯ |
| | | function selectRoleByUserId() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectRoleByUserId?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&id=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åå个è§è²ä¿¡æ¯ |
| | | function selectRoleById() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/role/selectRole?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&id=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åè§è²å表 |
| | | function selectRoles() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/role/selectByPageAndCount?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&name=&depid=&pageSize=10&pageIndex=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // è·åè§è²ä¸çç¨æ·ä¿¡æ¯ |
| | | function selectUserByRoleId() { |
| | | $.ajax({ |
| | | url: "http://127.0.0.1:12316/server/user/selectUserByRoleId?token=" + "b6d650b7-8eff-41f6-9fc7-8ec1c73cd567" + "&id=1", |
| | | type: "GET", |
| | | data: null, |
| | | dataType: "json", |
| | | contentType: "application/json", |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | | ä¸ä¼ è·¯å¾ï¼<span id="pathSpan"></span>ï¼å½å令çï¼<span id="tokenSpan"></span> |
| | | </body> |
| | | </html> |
| | |
| | | var app = {}; |
| | | var path = "20221128010101"; |
| | | var url = "http://127.0.0.1:12316/server/"; |
| | | var token = "f174edc5-8640-4490-a159-e2d181d2cef7"; |
| | | var token = "e62f5887-a398-4362-8bc1-7dd11b81e42e"; |
| | | |
| | | $(function () { |
| | | $("#pathSpan").html(path); |
| | |
| | | function aesDecrypt(word) { |
| | | return CryptoJS.enc.Utf8.stringify(CryptoJS.AES.decrypt(word, CryptoJS.enc.Utf8.parse(base64Decode("QSNzX2xGX3NFcnZlX2sueQ==")), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })).toString(); |
| | | } |
| | | </script> |
| | | </script> |
| | | <script> |
| | | function selectDbOverflowDep() { |
| | | var obj = { |