-
Notifications
You must be signed in to change notification settings - Fork 0
/
remoteLog.ts
46 lines (41 loc) · 1.54 KB
/
remoteLog.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function remoteLog(obj: any, title: string = "", sql: boolean = false) : boolean {
let lClient: WebServiceClient = new WebServiceClient();
lClient.requestHeaders.setHttpHeader("Content-Type", "application/json");
lClient.timeout = 60;
lClient.baseUrl = 'http://172.20.253.71:8080';
let socket_id = "HCN4o0cH600xLKEVAAAG";
let post_item = {};
if (obj instanceof Resultset) {
let table = (function (resultSet :Resultset) : Array<any> {
var table = [];
if (resultSet.hasRows()) {
do {
let obj = {};
for (let j = 0, len = resultSet.getColumnCount(); j < len; j++) {
var cname = resultSet.getColumnName(j);
obj[cname] = resultSet.getString(cname);
}
table.push(obj);
} while (resultSet.moveToNext())
}
resultSet.moveToFirst();
return table;
})(obj);
if (table.length > 0) {
post_item = {socket_id: socket_id
,title : title
,obj : table
};
}
} else {
post_item = {socket_id: socket_id
,title : title
,obj : obj
,lang : sql ? "sql" : undefined
};
}
try {
lClient.post('/log', JSON.stringify(post_item));
} catch (error) {}
return true
}