sbd-npm 1.4.95 → 1.4.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/status.js CHANGED
@@ -76,20 +76,20 @@ $(function () {
76
76
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], date: $("#ip_date").val()}, function (j) {
77
77
  let html = [];
78
78
  if (!$("#start_time").length) {
79
- html.push("<tr><th width='25%'>系统时区</th><td>", Status.map_url(j["timezone"]), "</td>");
80
- html.push("<th id='start_time' width='25%'>服务器运行时间</th><td colspan='3'>", Util.seconds_to_format(j["start_time"]), "(" + j["up_time"] + ")</td></tr>");
81
- html.push("<tr><th>数据库最后同步时间</th><td>", Util.seconds_to_format(j["sync_end_time"]), "</td>");
82
- html.push("<th>数据库句柄更新时间</th><td colspan='3'>", Util.seconds_to_format(j["db_time"]), "</td></tr>");
83
- html.push("<tr><th>成交量最后同步时间</th><td>", Util.seconds_to_format(j["sync_amount_time"]), "</td>");
84
- html.push("<th>位置数据最后同步时间</th><td colspan='3'>", Util.seconds_to_format(j["location_time"]), "</td></tr>");
79
+ html.push("<tr><th width='25%'>系统时区</th><td>", Status.map_url(j.timezone), "</td>");
80
+ html.push("<th id='start_time' width='25%'>服务器运行时间</th><td colspan='3'>", Util.seconds_to_format(j.start_time), "(" + j.up_time + ")</td></tr>");
81
+ html.push("<tr><th>数据库最后同步时间</th><td>", Util.seconds_to_format(j.sync_end_time), "</td>");
82
+ html.push("<th>数据库句柄更新时间</th><td colspan='3'>", Util.seconds_to_format(j.db_time), "</td></tr>");
83
+ html.push("<tr><th>成交量最后同步时间</th><td>", Util.seconds_to_format(j.sync_amount_time), "</td>");
84
+ html.push("<th>位置数据最后同步时间</th><td colspan='3'>", Util.seconds_to_format(j.location_time), "</td></tr>");
85
85
  // 数据库
86
- html.push("<tr><th>数据库版本</th><td>", j["db_version"], "</td>");
87
- let mysql_connections = "<a data-toggle='modal' data-target='.mysql_process_modal'><b>" + j["mysql_process_num"] + "</b></a> / " + j["max_connections"];
86
+ html.push("<tr><th>数据库版本</th><td>", j.db_version, "</td>");
87
+ let mysql_connections = "<a data-toggle='modal' data-target='.mysql_process_modal'><b>" + j.mysql_process_num + "</b></a> / " + j.max_connections;
88
88
  html.push("<th>数据库当前连接数 / 最大连接数</th><td colspan='3'>", mysql_connections, "</td></tr>");
89
89
  let mysql_remote_ip = "--";
90
- if (j["mysql_remote_ip"]) {
90
+ if (j.mysql_remote_ip) {
91
91
  let mri_html = [];
92
- j["mysql_remote_ip"].forEach(function (remote_ip) {
92
+ j.mysql_remote_ip.forEach(function (remote_ip) {
93
93
  mri_html.push(Status.pack_ip_link(remote_ip));
94
94
  });
95
95
  mysql_remote_ip = mri_html.join("、");
@@ -97,33 +97,33 @@ $(function () {
97
97
  html.push("<tr><th><a data-toggle='modal' data-target='.mysql_access_modal'>数据库正在连接的IP</a></th><td colspan='5'>", mysql_remote_ip, "</td></tr>");
98
98
 
99
99
  let max_files_tips = "系统允许打开的最大文件描述符数量(即每个进程最多能打开多少个文件,包括网络连接、管道、实际文件等)";
100
- html.push("<tr><th>最大文件描述符数量 <i class='glyphicon glyphicon-info-sign' data-toggle='tooltip' data-original-title='", max_files_tips, "'></i></th><td>", (j["max_files"] == "None" ? "--" : j["max_files"]), "</td>");
101
- html.push("<th>硬盘可用空间 / 硬盘最大空间</th><td colspan='3'>", j["disk_available_size"], " / ", j["disk_total_size"], "</td></tr>");
100
+ html.push("<tr><th>最大文件描述符数量 <i class='glyphicon glyphicon-info-sign' data-toggle='tooltip' data-original-title='", max_files_tips, "'></i></th><td>", (j.max_files == "None" ? "--" : j.max_files), "</td>");
101
+ html.push("<th>硬盘可用空间 / 硬盘最大空间</th><td colspan='3'>", j.disk_available_size, " / ", j.disk_total_size, "</td></tr>");
102
102
 
103
103
  let load_average_tips = "系统负载均衡信息是指在一段时间内系统中正在运行或等待运行的进程数量的平均值。它通常以三个数字表示,分别对应于最近1分钟、5分钟和15分钟的时间段";
104
104
  let load_average = "--";
105
- if (j["load_average"]) {
106
- let load_average1_cls = j["load_average"][0] < 1 ? "success" : (j["load_average"][0] < 2 ? "info" : "danger");
107
- let load_average5_cls = j["load_average"][1] < 1 ? "success" : (j["load_average"][1] < 2 ? "info" : "danger");
108
- let load_average15_cls = j["load_average"][2] < 1 ? "success" : (j["load_average"][2] < 2 ? "info" : "danger");
109
- load_average = "1分钟平均负载: <span class='label label-" + load_average1_cls + "'>" + Util.to_float(j["load_average"][0], 2) + "</span> 5分钟平均负载: <span class='label label-" + load_average5_cls + "'>" + Util.to_float(j["load_average"][1], 2) + "</span> 15分钟平均负载: <span class='label label-" + load_average15_cls + "'>" + Util.to_float(j["load_average"][2], 2) + "</span>";
105
+ if (j.load_average) {
106
+ let load_average1_cls = j.load_average[0] < 1 ? "success" : (j.load_average[0] < 2 ? "info" : "danger");
107
+ let load_average5_cls = j.load_average[1] < 1 ? "success" : (j.load_average[1] < 2 ? "info" : "danger");
108
+ let load_average15_cls = j.load_average[2] < 1 ? "success" : (j.load_average[2] < 2 ? "info" : "danger");
109
+ load_average = "1分钟平均负载: <span class='label label-" + load_average1_cls + "'>" + Util.to_float(j.load_average[0], 2) + "</span> 5分钟平均负载: <span class='label label-" + load_average5_cls + "'>" + Util.to_float(j.load_average[1], 2) + "</span> 15分钟平均负载: <span class='label label-" + load_average15_cls + "'>" + Util.to_float(j.load_average[2], 2) + "</span>";
110
110
  }
111
111
  html.push("<tr><th>系统负载均衡信息 <i class='glyphicon glyphicon-info-sign' data-toggle='tooltip' data-original-title='", load_average_tips, "'></i></th><td colspan='5'>", load_average, "</td><tr>");
112
112
 
113
- html.push("<tr><th>系统开放的端口</th><td colspan='5'>", j["open_ports"].join(", "), "</td></tr>");
113
+ html.push("<tr><th>系统开放的端口</th><td colspan='5'>", j.open_ports.join(", "), "</td></tr>");
114
114
 
115
115
  $("#status_head").prepend(html.join(""));
116
116
  $("[data-toggle='tooltip']").tooltip();
117
117
  }
118
- Status.render_ip_daily(j["ip_daily_data"]);
118
+ Status.render_ip_daily(j.ip_daily_data);
119
119
 
120
- if (j["phone_num"]) {
121
- $("#phone_query_head").attr("title", j["phone_num"]);
120
+ if (j.phone_num) {
121
+ $("#phone_query_head").attr("title", j.phone_num);
122
122
  }
123
- if (j["ip_date"]) {
123
+ if (j.ip_date) {
124
124
  let id_obj = $("#ip_date");
125
- id_obj.val(Util.seconds_to_format(j["ip_date"], "%Y-%m-%d"));
126
- id_obj.parent().attr("title", Util.seconds_to_format(j["ip_date"]));
125
+ id_obj.val(Util.seconds_to_format(j.ip_date, "%Y-%m-%d"));
126
+ id_obj.parent().attr("title", Util.seconds_to_format(j.ip_date));
127
127
  Util.bind_date_picker_callback("ip_date", Status.fetch_data);
128
128
  }
129
129
  Util.hide_tips();
@@ -138,23 +138,23 @@ $(function () {
138
138
  referer_replacement = u.hostname + ":" + u.port + "/";
139
139
  }
140
140
  ip_daily_data.forEach(function (item) {
141
- if (item["is_block"] === 1) {
141
+ if (item.is_block === 1) {
142
142
  html.push("<tr class='danger'>");
143
143
  } else {
144
144
  html.push("<tr>");
145
145
  }
146
- html.push("<td>", Status.pack_ip_link(item["ip"]), "</td>");
147
- html.push("<td>", Status.map_url(item['location']), "</td>");
148
- item["referer"] = item["referer"].replace("?", "?");
146
+ html.push("<td>", Status.pack_ip_link(item.ip), "</td>");
147
+ html.push("<td>", Status.map_url(item.location), "</td>");
148
+ item.referer = item.referer.replace("?", "?");
149
149
  if (referer_search && referer_replacement) {
150
- item["referer"] = item["referer"].replace(referer_search, referer_replacement);
150
+ item.referer = item.referer.replace(referer_search, referer_replacement);
151
151
  }
152
- html.push("<td title='", item["referer"], "'>", Util.pack_html_link("http://" + item["referer"], Util.substring(item["referer"], 50)), "</td>");
153
- html.push("<td>", item["visit"], "</td>");
154
- if (item["is_block"] === 1) {
155
- html.push("<td>", Util.seconds_to_format(item["time"]), "</td>");
152
+ html.push("<td title='", item.referer, "'>", Util.pack_html_link("http://" + item.referer, Util.substring(item.referer, 50)), "</td>");
153
+ html.push("<td>", item.visit, "</td>");
154
+ if (item.is_block === 1) {
155
+ html.push("<td>", Util.seconds_to_format(item.time), "</td>");
156
156
  } else {
157
- html.push("<td><a href='#' class='block_ip'>", Util.seconds_to_format(item["time"]), "</a></td>");
157
+ html.push("<td><a href='#' class='block_ip'>", Util.seconds_to_format(item.time), "</a></td>");
158
158
  }
159
159
  html.push("</tr>");
160
160
  });
@@ -172,17 +172,17 @@ $(function () {
172
172
  Util.show_loading();
173
173
  Util.post(location.pathname, {"active_div": "mysql_process"}, function (j) {
174
174
  let html = [], current_connections = 0;
175
- j["data"].forEach(function (item) {
175
+ j.data.forEach(function (item) {
176
176
  current_connections++;
177
177
  html.push("<tr>");
178
- html.push("<td>", item["Id"], "</td>");
179
- html.push("<td>", item["User"], "</td>");
180
- html.push("<td>", Status.pack_ip_link(item["Host"]), "</td>");
181
- html.push("<td>", item["db"], "</td>");
182
- html.push("<td>", item["Command"], "</td>");
183
- html.push("<td>", item["Time"], "</td>");
184
- html.push("<td>", item["State"], "</td>");
185
- html.push("<td>", item["Info"], "</td>");
178
+ html.push("<td>", item.Id, "</td>");
179
+ html.push("<td>", item.User, "</td>");
180
+ html.push("<td>", Status.pack_ip_link(item.Host), "</td>");
181
+ html.push("<td>", item.db, "</td>");
182
+ html.push("<td>", item.Command, "</td>");
183
+ html.push("<td>", item.Time, "</td>");
184
+ html.push("<td>", item.State, "</td>");
185
+ html.push("<td>", item.Info, "</td>");
186
186
  html.push("</tr>");
187
187
  });
188
188
  Util.render_table_html("mysql_process_modal_body_body", html);
@@ -195,23 +195,23 @@ $(function () {
195
195
  Util.show_loading();
196
196
  Util.post(location.pathname, {"active_div": "mysql_access", "filter_type": $("#mysql_access_filter").val()}, function (j) {
197
197
  let html = [], ip_num = 0;
198
- j["data"].forEach(function (item) {
198
+ j.data.forEach(function (item) {
199
199
  ip_num++;
200
- if (item["is_block"] === 1) {
200
+ if (item.is_block === 1) {
201
201
  html.push("<tr class='danger'>");
202
202
  } else {
203
203
  html.push("<tr>");
204
204
  }
205
205
  html.push("<td><a href='#' class='block_ip'>", ip_num, "</a></td>");
206
- html.push("<td>", Util.pack_html_link(Status.ip_url(item["ip"]), item["ip"]), "</td>");
206
+ html.push("<td>", Util.pack_html_link(Status.ip_url(item.ip), item.ip), "</td>");
207
207
  html.push("<td>", Status.map_url(Status.convert_ip_address(item)), "</td>");
208
- html.push("<td>", item["times"], "</td>");
209
- html.push("<td>", Util.seconds_to_format(item["first_time"]), "</td>");
210
- html.push("<td>", Util.seconds_to_format(item["latest_time"]), "</td>");
208
+ html.push("<td>", item.times, "</td>");
209
+ html.push("<td>", Util.seconds_to_format(item.first_time), "</td>");
210
+ html.push("<td>", Util.seconds_to_format(item.latest_time), "</td>");
211
211
  html.push("</tr>");
212
212
  });
213
213
  Util.render_table_html("mysql_access_modal_body_body", html);
214
- $("#mysql_access_summary").html("&nbsp;&nbsp;共 <span class='label label-info'>" + j["total_len"] + "</span> 条,屏蔽 <span class='label label-danger'>" + j["block_len"] + "</span> 条");
214
+ $("#mysql_access_summary").html("&nbsp;&nbsp;共 <span class='label label-info'>" + j.total_len + "</span> 条,屏蔽 <span class='label label-danger'>" + j.block_len + "</span> 条");
215
215
  $("#mysql_access_modal_body_body .block_ip").each(function() {
216
216
  $(this).click(function() {
217
217
  let ip = $(this).parent().parent().children('td').eq(1).text();
@@ -233,9 +233,9 @@ $(function () {
233
233
  Util.show_loading();
234
234
  Util.post(location.pathname, {"active_div": "block_ip", "ip": ip}, function (j) {
235
235
  Util.hide_tips();
236
- if (j["code"] === 1) {
236
+ if (j.code === 1) {
237
237
  Util.show_tips("IP “ " + ip_address + " ” 已加到屏蔽队列中", 4567, "alert-success");
238
- } else if (j["code"] === 2) {
238
+ } else if (j.code === 2) {
239
239
  Util.show_tips("IP “ " + ip_address + " ” 已在屏蔽队列中", 4567, "alert-success");
240
240
  } else {
241
241
  Util.show_tips("屏蔽IP “ " + ip_address + " ” 失败", 4567, "alert-danger");
@@ -294,29 +294,29 @@ $(function () {
294
294
  let is_py_process = $("#is_py_process").prop("checked") ? "1" : "0";
295
295
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_py_process: is_py_process}, function (j) {
296
296
  let html = [], process_num = 0;
297
- let screen_pid = j["screen_pid"] ? j["screen_pid"] : 0;
298
- let screen_pid_date = j["screen_pid_date"] ? j["screen_pid_date"] : 0;
299
- j["data"].forEach(function (item) {
297
+ let screen_pid = j.screen_pid ? j.screen_pid : 0;
298
+ let screen_pid_date = j.screen_pid_date ? j.screen_pid_date : 0;
299
+ j.data.forEach(function (item) {
300
300
  process_num++;
301
301
  let is_screen = 0;
302
- if (screen_pid === item["pid"]) {
302
+ if (screen_pid === item.pid) {
303
303
  is_screen = 1;
304
304
  } else {
305
- let parameter = Status.match_cmdline_parameter(item["cmdline"]);
305
+ let parameter = Status.match_cmdline_parameter(item.cmdline);
306
306
  if (parameter.length > 0) {
307
307
  is_screen = 1;
308
308
  }
309
309
  }
310
310
  html.push("<tr>");
311
- html.push("<td>", item["pid"], "</td>");
312
- html.push("<td>", item["name"], "</td>");
313
- html.push("<td>", item["username"], "</td>");
314
- html.push("<td>", item["status"], "</td>");
315
- html.push("<td data-val='", item["rss"], "'>", Util.trans_byte_size(item["rss"]), "</td>");
316
- html.push("<td data-val='", item["vms"], "'>", Util.trans_byte_size(item["vms"]), "</td>");
317
- html.push("<td title='", item["cmdline"], "'>", Util.substring(item["cmdline"], 60), "</td>");
318
- html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
319
- html.push(Status.pack_screen_html(is_screen, item["pid"], screen_pid, screen_pid_date, item["cmdline"]));
311
+ html.push("<td>", item.pid, "</td>");
312
+ html.push("<td>", item.name, "</td>");
313
+ html.push("<td>", item.username, "</td>");
314
+ html.push("<td>", item.status, "</td>");
315
+ html.push("<td data-val='", item.rss, "'>", Util.trans_byte_size(item.rss), "</td>");
316
+ html.push("<td data-val='", item.vms, "'>", Util.trans_byte_size(item.vms), "</td>");
317
+ html.push("<td title='", item.cmdline, "'>", Util.substring(item.cmdline, 60), "</td>");
318
+ html.push("<td>", Util.seconds_to_format(item.create_time), "</td>");
319
+ html.push(Status.pack_screen_html(is_screen, item.pid, screen_pid, screen_pid_date, item.cmdline));
320
320
  html.push("</tr>");
321
321
  });
322
322
  Util.render_table_html("process_div_body", html);
@@ -342,12 +342,12 @@ $(function () {
342
342
  });
343
343
  }
344
344
  Util.post(location.pathname, {active_div: "get_block_ip"}, function (j) {
345
- let html = [], ip_num = j["num"];
346
- $("#block_ip_num").html("&nbsp;&nbsp;共 <span class='label label-info'>" + ip_num + "</span> 条(" + j["total_ip_num"] + ")&nbsp;");
347
- j["data"].forEach(function (item) {
345
+ let html = [], ip_num = j.num;
346
+ $("#block_ip_num").html("&nbsp;&nbsp;共 <span class='label label-info'>" + ip_num + "</span> 条(" + j.total_ip_num + ")&nbsp;");
347
+ j.data.forEach(function (item) {
348
348
  html.push("<tr>");
349
349
  html.push("<td>", ip_num, "</td>");
350
- html.push("<td>", Util.pack_html_link(Status.ip_url(item["ip"]), item["ip"]), "</td>");
350
+ html.push("<td>", Util.pack_html_link(Status.ip_url(item.ip), item.ip), "</td>");
351
351
  html.push("<td>", Status.map_url(Status.convert_ip_address(item)), "</td>");
352
352
  html.push("</tr>");
353
353
  ip_num--;
@@ -374,16 +374,15 @@ $(function () {
374
374
  }
375
375
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
376
376
  let html = [], login_num = 0;
377
- j["data"].forEach(function (item) {
377
+ j.data.forEach(function (item) {
378
378
  login_num++;
379
- let cls = item["date"].indexOf('logged in') > -1 ? "danger" : "";
380
- html.push("<tr class='", cls, "'>");
379
+ html.push("<tr", (item.date.includes('logged in') ? " class='danger'" : ""), ">");
381
380
  html.push("<td>", login_num, "</td>");
382
- html.push("<td>", item["user"], "</td>");
383
- html.push("<td>", item["terminal"], "</td>");
384
- html.push("<td>", Status.pack_ip_link(item["ip"]), "</td>");
381
+ html.push("<td>", item.user, "</td>");
382
+ html.push("<td>", item.terminal, "</td>");
383
+ html.push("<td>", Status.pack_ip_link(item.ip), "</td>");
385
384
  html.push("<td>", Status.map_url(Status.convert_ip_address(item)), "</td>");
386
- html.push("<td>", item["date"], "</td>");
385
+ html.push("<td>", item.date, "</td>");
387
386
  html.push("</tr>");
388
387
  });
389
388
  Util.render_table_html("login_log_div_body", html);
@@ -413,19 +412,19 @@ $(function () {
413
412
  }
414
413
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
415
414
  let html = [], table_num = 0;
416
- j["data"].forEach(function (item) {
415
+ j.data.forEach(function (item) {
417
416
  table_num++;
418
417
  html.push("<tr>");
419
418
  html.push("<td>", table_num, "</td>");
420
- html.push("<td>", item["TABLE_NAME"], "</td>");
421
- html.push("<td>", item["ENGINE"], "</td>");
422
- html.push("<td>", item["ROW_FORMAT"], "</td>");
423
- html.push("<td>", item["TABLE_ROWS"], "</td>");
424
- html.push("<td>", item["data_size"], "</td>");
425
- html.push("<td>", item["index_size"], "</td>");
426
- html.push("<td>", item["UPDATE_TIME"], "</td>");
427
- html.push("<td>", item["CREATE_TIME"], "</td>");
428
- html.push("<td>", item["TABLE_COMMENT"], "</td>");
419
+ html.push("<td>", item.TABLE_NAME, "</td>");
420
+ html.push("<td>", item.ENGINE, "</td>");
421
+ html.push("<td>", item.ROW_FORMAT, "</td>");
422
+ html.push("<td>", item.TABLE_ROWS, "</td>");
423
+ html.push("<td>", item.data_size, "</td>");
424
+ html.push("<td>", item.index_size, "</td>");
425
+ html.push("<td>", item.UPDATE_TIME, "</td>");
426
+ html.push("<td>", item.CREATE_TIME, "</td>");
427
+ html.push("<td>", item.TABLE_COMMENT, "</td>");
429
428
  html.push("</tr>");
430
429
  });
431
430
  Util.render_table_html("database_table_div_body", html);
@@ -458,19 +457,19 @@ $(function () {
458
457
  }
459
458
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
460
459
  let html = [], database_variable_num = 0;
461
- j["data"].forEach(function (item) {
460
+ j.data.forEach(function (item) {
462
461
  database_variable_num++;
463
462
  html.push("<tr>");
464
463
  if (is_mobile) {
465
- html.push("<td class='text-left' style='word-break: break-all'>", item["key"], "</td>");
464
+ html.push("<td class='text-left' style='word-break: break-all'>", item.key, "</td>");
466
465
  } else {
467
466
  html.push("<td>", database_variable_num, "</td>");
468
- html.push("<td class='text-right'>", item["key"], "</td>");
467
+ html.push("<td class='text-right'>", item.key, "</td>");
469
468
  }
470
- if (item["key"] === "innodb_buffer_pool_size") {
471
- item["val"] += " (" + Util.trans_byte_size(item["val"]) + ")";
469
+ if (item.key === "innodb_buffer_pool_size") {
470
+ item.val += " (" + Util.trans_byte_size(item.val) + ")";
472
471
  }
473
- html.push("<td class='text-left' style='word-break: break-all'>", item["val"], "</td>");
472
+ html.push("<td class='text-left' style='word-break: break-all'>", item.val, "</td>");
474
473
  html.push("</tr>");
475
474
  });
476
475
  Util.render_table_html("database_variable_div_body", html);
@@ -526,11 +525,11 @@ $(function () {
526
525
  }
527
526
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
528
527
  let html = [], environment_num = 0;
529
- j["data"].forEach(function (item) {
528
+ j.data.forEach(function (item) {
530
529
  environment_num++;
531
530
  html.push("<tr>");
532
- html.push("<td class='text-right'>", item["key"], "</td>");
533
- html.push("<td class='text-left' style='word-break: break-all'>", item["val"], "</td>");
531
+ html.push("<td class='text-right'>", item.key, "</td>");
532
+ html.push("<td class='text-left' style='word-break: break-all'>", item.val, "</td>");
534
533
  html.push("</tr>");
535
534
  });
536
535
  Util.render_table_html("environment_div_body", html);
@@ -563,7 +562,7 @@ $(function () {
563
562
  }
564
563
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
565
564
  let html = [], sysctl_num = 0;
566
- j["data"].forEach(function (item) {
565
+ j.data.forEach(function (item) {
567
566
  sysctl_num++;
568
567
  html.push("<tr>");
569
568
  if (is_mobile) {
@@ -618,15 +617,15 @@ $(function () {
618
617
  Util.show_loading();
619
618
  $("#task_tips").html("");
620
619
  Util.post(location.pathname, {active_div: "task_add", "task_content": task_content, machine_id: $("#task_machines").val()}, function (j) {
621
- if (j["code"] === 1) {
620
+ if (j.code === 1) {
622
621
  Status.task_status = 1;
623
622
  $("#task_add").html('任务处理中...').removeClass("btn-default").addClass("btn-warning");
624
623
  if (!document.getElementById("task_result")) {
625
624
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
626
625
  }
627
- let task_result = "任务 `" + j["content"] + "` 处理中...";
628
- if (j["chinese"]) {
629
- task_result += " [" + j["chinese"] + "]";
626
+ let task_result = "任务 `" + j.content + "` 处理中...";
627
+ if (j.chinese) {
628
+ task_result += " [" + j.chinese + "]";
630
629
  }
631
630
  $("#task_result").val(task_result);
632
631
  if ($("#is_refresh_task").prop("checked")) {
@@ -636,11 +635,11 @@ $(function () {
636
635
  }
637
636
  } else {
638
637
  Status.task_status = 0;
639
- if (j["code"] === 2) {
640
- let do_content = j["do_content"] ? ("(" + j["do_content"] + ")") : "";
638
+ if (j.code === 2) {
639
+ let do_content = j.do_content ? ("(" + j.do_content + ")") : "";
641
640
  $("#task_tips").html("<b class='text-danger'>已添加新任务" + do_content + "在处理中!</b>");
642
- } else if (j["code"] === 3) {
643
- let doing_content = j["doing_content"] ? ("(" + j["doing_content"] + ")") : "";
641
+ } else if (j.code === 3) {
642
+ let doing_content = j.doing_content ? ("(" + j.doing_content + ")") : "";
644
643
  $("#task_tips").html("<b class='text-danger'>有任务" + doing_content + "在执行中!</b>");
645
644
  } else {
646
645
  $("#task_tips").html("<b class='text-danger'>参数异常!</b>");
@@ -685,9 +684,9 @@ $(function () {
685
684
  fetch_task_data: function(is_init = 0) {
686
685
  let machine_id = $("#task_machines").val();
687
686
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: machine_id}, function (j) {
688
- if (j["machines"]) {
689
- Status.pack_machine_component("task_machines", j["machines"]);
690
- if (j["machines"].length > 0) {
687
+ if (j.machines) {
688
+ Status.pack_machine_component("task_machines", j.machines);
689
+ if (j.machines.length > 0) {
691
690
  $("#task_machines").change(function() {
692
691
  Util.show_loading();
693
692
  $("#task_tips").html("");
@@ -700,18 +699,18 @@ $(function () {
700
699
  $('#task_machines').html('<option value="">暂无Machine</option>');
701
700
  }
702
701
  }
703
- if (j["code"] && j["code"] > 1 && j["content"]) {
702
+ if (j.code && j.code > 1 && j.content) {
704
703
  let ta_obj = $("#task_add");
705
704
  let tc_obj = $("#task_content");
706
- tc_obj.val(j["content"]);
707
- if (j["code"] === 4) {
705
+ tc_obj.val(j.content);
706
+ if (j.code === 4) {
708
707
  if (Status.task_status > 0) {
709
708
  clearTimeout(Status.task_timer_id);
710
709
  }
711
710
  Status.task_status = 0;
712
711
  ta_obj.html('添加任务').prop('disabled', false).removeClass("btn-warning").addClass("btn-default");
713
712
  tc_obj.prop('disabled', false);
714
- $("#task_tips").html("<b class='text-success'>任务 `" + j["content"] + "` DONE</b>");
713
+ $("#task_tips").html("<b class='text-success'>任务 `" + j.content + "` DONE</b>");
715
714
  } else {
716
715
  Status.task_status = 1;
717
716
  ta_obj.html('任务处理中...').prop('disabled', true).removeClass("btn-default").addClass("btn-warning");
@@ -725,13 +724,13 @@ $(function () {
725
724
  if (!document.getElementById("task_result")) {
726
725
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
727
726
  }
728
- if (j["result"]) {
727
+ if (j.result) {
729
728
  let tr_obj = $("#task_result");
730
- tr_obj.val(j["result"]);
729
+ tr_obj.val(j.result);
731
730
  tr_obj.scrollTop(tr_obj[0].scrollHeight);
732
731
  } else {
733
- if (j["code"] !== 4) {
734
- $("#task_result").val("任务 `" + j["content"] + "` 处理中...");
732
+ if (j.code !== 4) {
733
+ $("#task_result").val("任务 `" + j.content + "` 处理中...");
735
734
  }
736
735
  }
737
736
  } else {
@@ -739,13 +738,13 @@ $(function () {
739
738
  clearTimeout(Status.task_timer_id);
740
739
  }
741
740
  Status.task_status = 0;
742
- if (j["is_new"] && j["is_new"] === 1) {
741
+ if (j.is_new && j.is_new === 1) {
743
742
  $("#task_content").val("").prop('disabled', false);
744
743
  $("#task_add").html('添加任务').prop('disabled', false).removeClass("btn-warning").addClass("btn-default");
745
744
  }
746
745
  }
747
- if (j["ip_process_num"]) {
748
- $("#task_machines option[value='" + machine_id + "']").text(j["ip_process_num"]);
746
+ if (j.ip_process_num) {
747
+ $("#task_machines option[value='" + machine_id + "']").text(j.ip_process_num);
749
748
  }
750
749
  Util.hide_tips();
751
750
  });
@@ -794,9 +793,9 @@ $(function () {
794
793
  }
795
794
  }
796
795
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: $("#machines").val()}, function (j) {
797
- if (j["machines"]) {
798
- Status.pack_machine_component("machines", j["machines"]);
799
- if (j["machines"].length > 0) {
796
+ if (j.machines) {
797
+ Status.pack_machine_component("machines", j.machines);
798
+ if (j.machines.length > 0) {
800
799
  $("#machines").change(function() {
801
800
  let machine_id = $(this).val();
802
801
  if (machine_id) {
@@ -806,7 +805,7 @@ $(function () {
806
805
  }
807
806
  });
808
807
  }
809
- } else if (j["process"]) {
808
+ } else if (j.process) {
810
809
  if (!document.getElementById("machine_process_div_body")) {
811
810
  let prefix_caption = "";
812
811
  if (Util.is_mobile()) {
@@ -827,19 +826,19 @@ $(function () {
827
826
  });
828
827
  }
829
828
  let html = [], process_num = 0;
830
- let screen_pid = j["screen_pid"] ? j["screen_pid"] : 0;
831
- let screen_pid_date = j["screen_pid_date"] ? j["screen_pid_date"] : 0;
832
- j["process"].forEach(function (item) {
829
+ let screen_pid = j.screen_pid ? j.screen_pid : 0;
830
+ let screen_pid_date = j.screen_pid_date ? j.screen_pid_date : 0;
831
+ j.process.forEach(function (item) {
833
832
  process_num++;
834
833
  let is_xmr = 0, is_screen = 0;
835
- if (item["cmdline"].includes("zotonic") || item["cmdline"].includes("xmrig")) {
834
+ if (item.cmdline.includes("zotonic") || item.cmdline.includes("xmrig")) {
836
835
  is_xmr = 1;
837
836
  is_screen = 1;
838
837
  } else {
839
- if (screen_pid === item["pid"]) {
838
+ if (screen_pid === item.pid) {
840
839
  is_screen = 1;
841
840
  } else {
842
- let parameter = Status.match_cmdline_parameter(item["cmdline"]);
841
+ let parameter = Status.match_cmdline_parameter(item.cmdline);
843
842
  if (parameter.length > 0) {
844
843
  is_screen = 1;
845
844
  }
@@ -850,21 +849,21 @@ $(function () {
850
849
  } else {
851
850
  html.push("<tr>");
852
851
  }
853
- html.push("<td>", item["pid"], "</td>");
854
- html.push("<td>", item["status"], "</td>");
855
- let cmdline = Util.substring(item["cmdline"], 100);
852
+ html.push("<td>", item.pid, "</td>");
853
+ html.push("<td>", item.status, "</td>");
854
+ let cmdline = Util.substring(item.cmdline, 100);
856
855
  if (is_xmr === 1) {
857
856
  html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
858
857
  } else {
859
- html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
858
+ html.push("<td title='", item.cmdline, "'>", cmdline, "</td>");
860
859
  }
861
- html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
862
- html.push(Status.pack_screen_html(is_screen, item["pid"], screen_pid, screen_pid_date, item["cmdline"]));
860
+ html.push("<td>", Util.seconds_to_format(item.create_time), "</td>");
861
+ html.push(Status.pack_screen_html(is_screen, item.pid, screen_pid, screen_pid_date, item.cmdline));
863
862
  html.push("</tr>");
864
863
  });
865
864
  Util.render_table_html("machine_process_div_body", html);
866
- $("#machine_process_tip").html('共 <span class="label label-info">' + process_num + '</span> 进程,最后更新时间:' + Util.seconds_to_format(j["date"]) + ',Revision:' + j["revision"] + ',MachineId:' + j["machine_id"]);
867
- $("#machines option[value='" + j["machine_id"] + "']").text(j["ip"] + "(" + process_num + ")");
865
+ $("#machine_process_tip").html('共 <span class="label label-info">' + process_num + '</span> 进程,最后更新时间:' + Util.seconds_to_format(j.date) + ',Revision:' + j.revision + ',MachineId:' + j.machine_id);
866
+ $("#machines option[value='" + j.machine_id + "']").text(j.ip + "(" + process_num + ")");
868
867
  // 终止进程
869
868
  Status.handle_process_kill("machine_process_div_body", 2);
870
869
  // 进程会话
@@ -891,11 +890,11 @@ $(function () {
891
890
  let machine_id = action_type === 2 ? $("#machines").val() : "";
892
891
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": action_type}, function (j) {
893
892
  Util.hide_tips();
894
- if (j["code"] === 1) {
893
+ if (j.code === 1) {
895
894
  Util.show_tips("进程 " + pid_action + " 已加到终止队列中", 4567, "alert-success");
896
- } else if (j["code"] === 2) {
895
+ } else if (j.code === 2) {
897
896
  Util.show_tips("Machine 不存在!", 4567, "alert-danger");
898
- } else if (j["code"] === 3) {
897
+ } else if (j.code === 3) {
899
898
  Util.show_tips("进程 " + pid_action + " 异常!", 4567, "alert-danger");
900
899
  } else {
901
900
  Util.show_tips("进程值不能为空!", 4567, "alert-danger");
@@ -921,8 +920,8 @@ $(function () {
921
920
  let machine_id = action_type === 2 ? $("#machines").val() : "";
922
921
  Util.post(location.pathname, {active_div: "machine_screen", "machine_id": machine_id, "pid": pid, "instruction": instruction}, function (j) {
923
922
  Util.hide_tips();
924
- if (j["data"]) {
925
- Util.showAlert(j["data"]);
923
+ if (j.data) {
924
+ Util.showAlert(j.data);
926
925
  } else {
927
926
  Util.show_tips("数据异常!", 4567, "alert-danger");
928
927
  }
@@ -937,7 +936,7 @@ $(function () {
937
936
  let machine_id = action_type === 2 ? $("#machines").val() : "";
938
937
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": action_type}, function (j) {
939
938
  Util.hide_tips();
940
- if (j["code"] === 1) {
939
+ if (j.code === 1) {
941
940
  $("#" + element_id + " a").each(function() {
942
941
  let span_obj = $(this).find('span.label.label-info');
943
942
  if (span_obj.length) {
@@ -953,9 +952,9 @@ $(function () {
953
952
  });
954
953
  this_obj.html("<span title='会话数据获取中...' class='label label-info'>会话</span>");
955
954
  Util.show_tips("进程 [" + pid + "(" + action + ")] 已加到会话队列中", 4567, "alert-success");
956
- } else if (j["code"] === 2) {
955
+ } else if (j.code === 2) {
957
956
  Util.show_tips("Machine 不存在!", 4567, "alert-danger");
958
- } else if (j["code"] === 3) {
957
+ } else if (j.code === 3) {
959
958
  Util.show_tips("进程 [" + pid + "(" + action + ")] 异常!", 4567, "alert-danger");
960
959
  } else {
961
960
  Util.show_tips("进程值不能为空!", 4567, "alert-danger");
@@ -1117,16 +1116,16 @@ $(function () {
1117
1116
  $("#action_machine_div").css("display", "block");
1118
1117
  }
1119
1118
  Util.post(location.pathname, {active_div: "machine_instruction", action_type: action_type}, function (j) {
1120
- if (j["machines"]) {
1121
- Status.pack_machine_component("machine_instruction_machine", j["machines"]);
1119
+ if (j.machines) {
1120
+ Status.pack_machine_component("machine_instruction_machine", j.machines);
1122
1121
  let machine = $("#machines").val();
1123
1122
  if (machine) {
1124
1123
  $("#machine_instruction_machine").val(machine);
1125
1124
  }
1126
1125
  }
1127
- if (j["instructions"]) {
1126
+ if (j.instructions) {
1128
1127
  let instruction_html = [];
1129
- j["instructions"].forEach(function (instruction) {
1128
+ j.instructions.forEach(function (instruction) {
1130
1129
  instruction_html.push("<option value='", instruction, "'>", instruction, "</option>");
1131
1130
  });
1132
1131
  $("#machine_instruction_content").html(instruction_html.join(""));
@@ -1152,11 +1151,11 @@ $(function () {
1152
1151
  $("#machine_instruction_add").attr("disabled", true);
1153
1152
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, action_type: action_type}, function (j) {
1154
1153
  $("#machine_instruction_add").attr("disabled", false);
1155
- if (j["code"] === 1) {
1154
+ if (j.code === 1) {
1156
1155
  $("#machine_instruction_tips").html("<b class='text-success'>任务`" + instruction + "`添加成功!</b>");
1157
- } else if (j["code"] === 2) {
1156
+ } else if (j.code === 2) {
1158
1157
  $("#machine_instruction_tips").html("<b class='text-danger'>Machine 不存在!</b>");
1159
- } else if (j["code"] === 3) {
1158
+ } else if (j.code === 3) {
1160
1159
  $("#machine_instruction_tips").html("<b class='text-danger'>任务内容异常!</b>");
1161
1160
  } else {
1162
1161
  $("#machine_instruction_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
@@ -1206,8 +1205,8 @@ $(function () {
1206
1205
  ccm_obj.on('show.bs.modal', function (e) {
1207
1206
  Util.show_loading();
1208
1207
  Util.post(location.pathname, {active_div: "machine_instruction", action_type: 2}, function (j) {
1209
- if (j["machines"]) {
1210
- Status.pack_machine_component("machine_cookie_machine", j["machines"]);
1208
+ if (j.machines) {
1209
+ Status.pack_machine_component("machine_cookie_machine", j.machines);
1211
1210
  let machine = $("#machines").val();
1212
1211
  if (machine) {
1213
1212
  $("#machine_cookie_machine").val(machine);
@@ -1231,9 +1230,9 @@ $(function () {
1231
1230
  $("#machine_cookie_add").attr("disabled", true);
1232
1231
  Util.post(location.pathname, {active_div: "machine_cookie_add", "machine_id": machine_id, "cookie": machine_cookie}, function (j) {
1233
1232
  $("#machine_cookie_add").attr("disabled", false);
1234
- if (j["code"] === 1) {
1233
+ if (j.code === 1) {
1235
1234
  $("#machine_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
1236
- } else if (j["code"] === 2) {
1235
+ } else if (j.code === 2) {
1237
1236
  $("#machine_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
1238
1237
  } else {
1239
1238
  $("#machine_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
@@ -1293,10 +1292,10 @@ $(function () {
1293
1292
  $("#word_value").val("Loading...").attr('readonly', true);
1294
1293
  $("#word_chinese").val("Loading...").attr('readonly', true);
1295
1294
  Util.post(location.pathname, {"active_div": "word_random"}, function (j) {
1296
- if (j["word"]) {
1297
- $("#word_value").val(j["word"]);
1298
- $("#word_chinese").val(j["chinese"]);
1299
- $("#word_modal_title").html(Util.pack_html_link("https://cn.bing.com/dict/search?q=" + j["word"], "随机单词") + " <span style='color: #BDBDBD;'>(" + Util.seconds_to_format(j["date"]) + ")</span>");
1295
+ if (j.word) {
1296
+ $("#word_value").val(j.word);
1297
+ $("#word_chinese").val(j.chinese);
1298
+ $("#word_modal_title").html(Util.pack_html_link("https://cn.bing.com/dict/search?q=" + j.word, "随机单词") + " <span style='color: #BDBDBD;'>(" + Util.seconds_to_format(j.date) + ")</span>");
1300
1299
  }
1301
1300
  });
1302
1301
  } else {
@@ -1310,11 +1309,11 @@ $(function () {
1310
1309
  let chinese = $("#word_chinese").val();
1311
1310
  if (chinese) {
1312
1311
  Util.post(location.pathname, {"active_div": "word_modify", "word": word, "chinese": chinese}, function (j) {
1313
- if (j["code"] === 1) {
1314
- $("#word_chinese").val(j["chinese"]);
1315
- $(tr_obj).children('td').eq(2).html(j["chinese"]);
1312
+ if (j.code === 1) {
1313
+ $("#word_chinese").val(j.chinese);
1314
+ $(tr_obj).children('td').eq(2).html(j.chinese);
1316
1315
  $("#word_tips").html("<b class='text-success'>修改成功!</b>");
1317
- } else if (j["code"] === 2) {
1316
+ } else if (j.code === 2) {
1318
1317
  $("#word_tips").html("<b class='text-danger'>中文有误!</b>");
1319
1318
  } else {
1320
1319
  $("#word_tips").html("<b class='text-danger'>修改失败!</b>");
@@ -1379,21 +1378,21 @@ $(function () {
1379
1378
  Util.post("/action", {action: "ip_query", ip: ip}, function (j) {
1380
1379
  $("#ip").prop('disabled', false);
1381
1380
  $("#ip_query").attr("disabled", false);
1382
- if (j["ip"]) {
1383
- if (j["domain"]) {
1381
+ if (j.ip) {
1382
+ if (j.domain) {
1384
1383
  let domain = $("#ip").val().trim();
1385
- j["domain"] = domain ? domain : j["domain"];
1384
+ j.domain = domain ? domain : j.domain;
1386
1385
  }
1387
- $("#ip").val(j["ip"]);
1386
+ $("#ip").val(j.ip);
1388
1387
  let ip_address = Status.convert_ip_address(j);
1389
1388
  if (ip_address.length > 0) {
1390
1389
  let map_url = Status.map_url(ip_address, "<i class='glyphicon glyphicon-map-marker'></i>");
1391
- let ip_result = Util.pack_html_link(Status.ip_url(j["ip"]), "<b class='text-success'>" + ip_address + "</b>") + "&nbsp;&nbsp;&nbsp;" + map_url;
1392
- ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=SGVBZ-4RO34-NB2US-DQKYK-ZEUVJ-4KFZF&ip=" + j["ip"] + "&callback=Callback&_=" + Util.now(), "1");
1393
- ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("https://whois.pconline.com.cn/ipJson.jsp?ip=" + j["ip"] + "&json=true", "2");
1394
- ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("http://ip-api.com/json/" + j["ip"] + "?lang=zh-CN", "3");
1395
- if (j["domain"]) {
1396
- ip_result += "<br><br>" + Util.pack_html_link(j["domain"], "<b>" + j["domain"] + "</b>");
1390
+ let ip_result = Util.pack_html_link(Status.ip_url(j.ip), "<b class='text-success'>" + ip_address + "</b>") + "&nbsp;&nbsp;&nbsp;" + map_url;
1391
+ ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=SGVBZ-4RO34-NB2US-DQKYK-ZEUVJ-4KFZF&ip=" + j.ip + "&callback=Callback&_=" + Util.now(), "1");
1392
+ ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("https://whois.pconline.com.cn/ipJson.jsp?ip=" + j.ip + "&json=true", "2");
1393
+ ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("http://ip-api.com/json/" + j.ip + "?lang=zh-CN", "3");
1394
+ if (j.domain) {
1395
+ ip_result += "<br><br>" + Util.pack_html_link(j.domain, "<b>" + j.domain + "</b>");
1397
1396
  }
1398
1397
  $("#ip_result").html(ip_result);
1399
1398
  } else {
@@ -1546,7 +1545,7 @@ $(function () {
1546
1545
  Util.post("/action", {action: "phone_query", phone: phone}, function (j) {
1547
1546
  $("#phone").prop('disabled', false);
1548
1547
  $("#phone_query").attr("disabled", false);
1549
- if (j["belong"]) {
1548
+ if (j.belong) {
1550
1549
  let phone_url = Util.pack_html_link("https://www.ip138.com/mobile.asp?mobile=" + phone + "&action=mobile", "<i class='glyphicon glyphicon-link'></i> ");
1551
1550
  $("#phone_result").html(Status.convert_phone(j) + "&nbsp;&nbsp;" + phone_url);
1552
1551
  $("#phone_result a").addClass("text-success");
@@ -1626,7 +1625,7 @@ $(function () {
1626
1625
  referer: $("#search_referer").val()
1627
1626
  };
1628
1627
  Util.post(location.pathname, payload, function (j) {
1629
- Status.render_ip_daily(j["ip_daily_data"]);
1628
+ Status.render_ip_daily(j.ip_daily_data);
1630
1629
  Util.hide_tips();
1631
1630
  });
1632
1631
  $('#ip_modal').modal('hide');
@@ -1699,7 +1698,6 @@ $(function () {
1699
1698
  $("#phone").val(request_arguments["phone"]);
1700
1699
  setTimeout(() => {
1701
1700
  Status.phone_query();
1702
- Enterprise.fetch_enterprise_detail(j["unified_code"]);
1703
1701
  }, 1234);
1704
1702
  }
1705
1703
  } else {