|
@@ -5,31 +5,50 @@ const api = {
|
|
getSchema:'/api/ltkg/kg/getSchema',
|
|
getSchema:'/api/ltkg/kg/getSchema',
|
|
getTree:'/api/ltkg/kg/getTree',
|
|
getTree:'/api/ltkg/kg/getTree',
|
|
entity_predict:'http://192.168.3.150:3456/api/mr_info_ex/entity_predict'
|
|
entity_predict:'http://192.168.3.150:3456/api/mr_info_ex/entity_predict'
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+};
|
|
|
|
|
|
-const post = function (url, data) {
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- $.ajax({
|
|
|
|
- method: 'post',
|
|
|
|
- url: url,
|
|
|
|
- data: JSON.stringify(data),
|
|
|
|
- contentType: "application/json; charset=UTF-8",
|
|
|
|
- beforeSend: function (xmlHttp) {
|
|
|
|
- // xmlHttp.setRequestHeader("If-Modified-Since", "0");
|
|
|
|
- // xmlHttp.setRequestHeader("Cache-Control", "no-cache");
|
|
|
|
- },
|
|
|
|
- success: function (res) {
|
|
|
|
- resolve({ data: res });
|
|
|
|
- },
|
|
|
|
- error: function (error) {
|
|
|
|
- reject(error);
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+const getUrlArgObject = function(name) {//
|
|
|
|
+ var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
|
+ var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
|
|
|
|
+ var r = window.location.search.substr(1).match(reg);
|
|
|
|
+ var q = window.location.pathname.substr(1).match(reg_rewrite);
|
|
|
|
+ if (r != null) {
|
|
|
|
+ return decodeURIComponent(r[2]);
|
|
|
|
+ } else if (q != null) {
|
|
|
|
+ return decodeURIComponent(q[2]);
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+const post = function (url, data,pId) {
|
|
|
|
+ const securityCode = getUrlArgObject("code");
|
|
|
|
+ const appKeyId = getUrlArgObject("appI");
|
|
|
|
+ const appKeySecret = getUrlArgObject("appS");
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ $.ajax({
|
|
|
|
+ method: 'post',
|
|
|
|
+ url: url,
|
|
|
|
+ data: JSON.stringify(data),
|
|
|
|
+ contentType: "application/json; charset=UTF-8",
|
|
|
|
+ beforeSend: function (xmlHttp) {
|
|
|
|
+ xmlHttp.setRequestHeader("If-Modified-Since", "0");
|
|
|
|
+ xmlHttp.setRequestHeader("Cache-Control", "no-cache");
|
|
|
|
+ xmlHttp.setRequestHeader("appKeyId", appKeyId);
|
|
|
|
+ xmlHttp.setRequestHeader("appKeySecret", appKeySecret);
|
|
|
|
+ xmlHttp.setRequestHeader("securityCode", securityCode);
|
|
|
|
+ xmlHttp.setRequestHeader("productId", pId||146);
|
|
|
|
+ },
|
|
|
|
+ success: function (res) {
|
|
|
|
+ resolve({ data: res });
|
|
|
|
+ },
|
|
|
|
+ error: function (error) {
|
|
|
|
+ reject(error);
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
module.exports ={
|
|
module.exports ={
|
|
- post,
|
|
|
|
- api
|
|
|
|
|
|
+ post,
|
|
|
|
+ api
|
|
}
|
|
}
|