sbd-npm 1.4.96 → 1.4.98

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
120
  if (j.phone_num) {
121
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
  });
@@ -175,14 +175,14 @@ $(function () {
175
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);
@@ -197,21 +197,21 @@ $(function () {
197
197
  let html = [], ip_num = 0;
198
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,15 +294,15 @@ $(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;
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
299
  j.data.forEach(function (item) {
300
300
  process_num++;
301
301
  let is_screen = 0;
302
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
  }
@@ -310,13 +310,13 @@ $(function () {
310
310
  html.push("<tr>");
311
311
  html.push("<td>", item.pid, "</td>");
312
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"]));
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;");
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
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--;
@@ -378,9 +378,9 @@ $(function () {
378
378
  login_num++;
379
379
  html.push("<tr", (item.date.includes('logged in') ? " class='danger'" : ""), ">");
380
380
  html.push("<td>", login_num, "</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>");
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>");
384
384
  html.push("<td>", Status.map_url(Status.convert_ip_address(item)), "</td>");
385
385
  html.push("<td>", item.date, "</td>");
386
386
  html.push("</tr>");
@@ -416,15 +416,15 @@ $(function () {
416
416
  table_num++;
417
417
  html.push("<tr>");
418
418
  html.push("<td>", table_num, "</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>");
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>");
428
428
  html.push("</tr>");
429
429
  });
430
430
  Util.render_table_html("database_table_div_body", html);
@@ -617,15 +617,15 @@ $(function () {
617
617
  Util.show_loading();
618
618
  $("#task_tips").html("");
619
619
  Util.post(location.pathname, {active_div: "task_add", "task_content": task_content, machine_id: $("#task_machines").val()}, function (j) {
620
- if (j["code"] === 1) {
620
+ if (j.code === 1) {
621
621
  Status.task_status = 1;
622
622
  $("#task_add").html('任务处理中...').removeClass("btn-default").addClass("btn-warning");
623
623
  if (!document.getElementById("task_result")) {
624
624
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
625
625
  }
626
- let task_result = "任务 `" + j["content"] + "` 处理中...";
627
- if (j["chinese"]) {
628
- task_result += " [" + j["chinese"] + "]";
626
+ let task_result = "任务 `" + j.content + "` 处理中...";
627
+ if (j.chinese) {
628
+ task_result += " [" + j.chinese + "]";
629
629
  }
630
630
  $("#task_result").val(task_result);
631
631
  if ($("#is_refresh_task").prop("checked")) {
@@ -635,11 +635,11 @@ $(function () {
635
635
  }
636
636
  } else {
637
637
  Status.task_status = 0;
638
- if (j["code"] === 2) {
639
- let do_content = j["do_content"] ? ("(" + j["do_content"] + ")") : "";
638
+ if (j.code === 2) {
639
+ let do_content = j.do_content ? ("(" + j.do_content + ")") : "";
640
640
  $("#task_tips").html("<b class='text-danger'>已添加新任务" + do_content + "在处理中!</b>");
641
- } else if (j["code"] === 3) {
642
- 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 + ")") : "";
643
643
  $("#task_tips").html("<b class='text-danger'>有任务" + doing_content + "在执行中!</b>");
644
644
  } else {
645
645
  $("#task_tips").html("<b class='text-danger'>参数异常!</b>");
@@ -684,9 +684,9 @@ $(function () {
684
684
  fetch_task_data: function(is_init = 0) {
685
685
  let machine_id = $("#task_machines").val();
686
686
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: machine_id}, function (j) {
687
- if (j["machines"]) {
688
- Status.pack_machine_component("task_machines", j["machines"]);
689
- if (j["machines"].length > 0) {
687
+ if (j.machines) {
688
+ Status.pack_machine_component("task_machines", j.machines);
689
+ if (j.machines.length > 0) {
690
690
  $("#task_machines").change(function() {
691
691
  Util.show_loading();
692
692
  $("#task_tips").html("");
@@ -699,18 +699,18 @@ $(function () {
699
699
  $('#task_machines').html('<option value="">暂无Machine</option>');
700
700
  }
701
701
  }
702
- if (j["code"] && j["code"] > 1 && j["content"]) {
702
+ if (j.code && j.code > 1 && j.content) {
703
703
  let ta_obj = $("#task_add");
704
704
  let tc_obj = $("#task_content");
705
- tc_obj.val(j["content"]);
706
- if (j["code"] === 4) {
705
+ tc_obj.val(j.content);
706
+ if (j.code === 4) {
707
707
  if (Status.task_status > 0) {
708
708
  clearTimeout(Status.task_timer_id);
709
709
  }
710
710
  Status.task_status = 0;
711
711
  ta_obj.html('添加任务').prop('disabled', false).removeClass("btn-warning").addClass("btn-default");
712
712
  tc_obj.prop('disabled', false);
713
- $("#task_tips").html("<b class='text-success'>任务 `" + j["content"] + "` DONE</b>");
713
+ $("#task_tips").html("<b class='text-success'>任务 `" + j.content + "` DONE</b>");
714
714
  } else {
715
715
  Status.task_status = 1;
716
716
  ta_obj.html('任务处理中...').prop('disabled', true).removeClass("btn-default").addClass("btn-warning");
@@ -724,13 +724,13 @@ $(function () {
724
724
  if (!document.getElementById("task_result")) {
725
725
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
726
726
  }
727
- if (j["result"]) {
727
+ if (j.result) {
728
728
  let tr_obj = $("#task_result");
729
- tr_obj.val(j["result"]);
729
+ tr_obj.val(j.result);
730
730
  tr_obj.scrollTop(tr_obj[0].scrollHeight);
731
731
  } else {
732
- if (j["code"] !== 4) {
733
- $("#task_result").val("任务 `" + j["content"] + "` 处理中...");
732
+ if (j.code !== 4) {
733
+ $("#task_result").val("任务 `" + j.content + "` 处理中...");
734
734
  }
735
735
  }
736
736
  } else {
@@ -738,13 +738,13 @@ $(function () {
738
738
  clearTimeout(Status.task_timer_id);
739
739
  }
740
740
  Status.task_status = 0;
741
- if (j["is_new"] && j["is_new"] === 1) {
741
+ if (j.is_new && j.is_new === 1) {
742
742
  $("#task_content").val("").prop('disabled', false);
743
743
  $("#task_add").html('添加任务').prop('disabled', false).removeClass("btn-warning").addClass("btn-default");
744
744
  }
745
745
  }
746
- if (j["ip_process_num"]) {
747
- $("#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);
748
748
  }
749
749
  Util.hide_tips();
750
750
  });
@@ -793,9 +793,9 @@ $(function () {
793
793
  }
794
794
  }
795
795
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: $("#machines").val()}, function (j) {
796
- if (j["machines"]) {
797
- Status.pack_machine_component("machines", j["machines"]);
798
- if (j["machines"].length > 0) {
796
+ if (j.machines) {
797
+ Status.pack_machine_component("machines", j.machines);
798
+ if (j.machines.length > 0) {
799
799
  $("#machines").change(function() {
800
800
  let machine_id = $(this).val();
801
801
  if (machine_id) {
@@ -805,7 +805,7 @@ $(function () {
805
805
  }
806
806
  });
807
807
  }
808
- } else if (j["process"]) {
808
+ } else if (j.process) {
809
809
  if (!document.getElementById("machine_process_div_body")) {
810
810
  let prefix_caption = "";
811
811
  if (Util.is_mobile()) {
@@ -826,19 +826,19 @@ $(function () {
826
826
  });
827
827
  }
828
828
  let html = [], process_num = 0;
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) {
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) {
832
832
  process_num++;
833
833
  let is_xmr = 0, is_screen = 0;
834
- if (item["cmdline"].includes("zotonic") || item["cmdline"].includes("xmrig")) {
834
+ if (item.cmdline.includes("zotonic") || item.cmdline.includes("xmrig")) {
835
835
  is_xmr = 1;
836
836
  is_screen = 1;
837
837
  } else {
838
838
  if (screen_pid === item.pid) {
839
839
  is_screen = 1;
840
840
  } else {
841
- let parameter = Status.match_cmdline_parameter(item["cmdline"]);
841
+ let parameter = Status.match_cmdline_parameter(item.cmdline);
842
842
  if (parameter.length > 0) {
843
843
  is_screen = 1;
844
844
  }
@@ -850,20 +850,20 @@ $(function () {
850
850
  html.push("<tr>");
851
851
  }
852
852
  html.push("<td>", item.pid, "</td>");
853
- html.push("<td>", item["status"], "</td>");
854
- let cmdline = Util.substring(item["cmdline"], 100);
853
+ html.push("<td>", item.status, "</td>");
854
+ let cmdline = Util.substring(item.cmdline, 100);
855
855
  if (is_xmr === 1) {
856
856
  html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
857
857
  } else {
858
- html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
858
+ html.push("<td title='", item.cmdline, "'>", cmdline, "</td>");
859
859
  }
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"]));
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));
862
862
  html.push("</tr>");
863
863
  });
864
864
  Util.render_table_html("machine_process_div_body", html);
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 + ")");
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 + ")");
867
867
  // 终止进程
868
868
  Status.handle_process_kill("machine_process_div_body", 2);
869
869
  // 进程会话
@@ -890,11 +890,11 @@ $(function () {
890
890
  let machine_id = action_type === 2 ? $("#machines").val() : "";
891
891
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": action_type}, function (j) {
892
892
  Util.hide_tips();
893
- if (j["code"] === 1) {
893
+ if (j.code === 1) {
894
894
  Util.show_tips("进程 " + pid_action + " 已加到终止队列中", 4567, "alert-success");
895
- } else if (j["code"] === 2) {
895
+ } else if (j.code === 2) {
896
896
  Util.show_tips("Machine 不存在!", 4567, "alert-danger");
897
- } else if (j["code"] === 3) {
897
+ } else if (j.code === 3) {
898
898
  Util.show_tips("进程 " + pid_action + " 异常!", 4567, "alert-danger");
899
899
  } else {
900
900
  Util.show_tips("进程值不能为空!", 4567, "alert-danger");
@@ -936,7 +936,7 @@ $(function () {
936
936
  let machine_id = action_type === 2 ? $("#machines").val() : "";
937
937
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": action_type}, function (j) {
938
938
  Util.hide_tips();
939
- if (j["code"] === 1) {
939
+ if (j.code === 1) {
940
940
  $("#" + element_id + " a").each(function() {
941
941
  let span_obj = $(this).find('span.label.label-info');
942
942
  if (span_obj.length) {
@@ -952,9 +952,9 @@ $(function () {
952
952
  });
953
953
  this_obj.html("<span title='会话数据获取中...' class='label label-info'>会话</span>");
954
954
  Util.show_tips("进程 [" + pid + "(" + action + ")] 已加到会话队列中", 4567, "alert-success");
955
- } else if (j["code"] === 2) {
955
+ } else if (j.code === 2) {
956
956
  Util.show_tips("Machine 不存在!", 4567, "alert-danger");
957
- } else if (j["code"] === 3) {
957
+ } else if (j.code === 3) {
958
958
  Util.show_tips("进程 [" + pid + "(" + action + ")] 异常!", 4567, "alert-danger");
959
959
  } else {
960
960
  Util.show_tips("进程值不能为空!", 4567, "alert-danger");
@@ -1077,7 +1077,7 @@ $(function () {
1077
1077
 
1078
1078
  init_machine_instruction_modal: function () {
1079
1079
  Util.init_modal_skeleton("machine_instruction_modal");
1080
- $("#machine_instruction_modal_title").html("添加任务");
1080
+ $("#machine_instruction_modal_title").html("添加任务<span style='color: #BDBDBD;' id='machine_instruction_modal_title_tips'></span>");
1081
1081
  let html = [];
1082
1082
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
1083
1083
  html.push('<div class="form-group" id="action_machine_div">');
@@ -1115,21 +1115,23 @@ $(function () {
1115
1115
  } else {
1116
1116
  $("#action_machine_div").css("display", "block");
1117
1117
  }
1118
- Util.post(location.pathname, {active_div: "machine_instruction", action_type: action_type}, function (j) {
1119
- if (j["machines"]) {
1120
- Status.pack_machine_component("machine_instruction_machine", j["machines"]);
1121
- let machine = $("#machines").val();
1122
- if (machine) {
1123
- $("#machine_instruction_machine").val(machine);
1118
+ let machine_id = $("#machines").val();
1119
+ Util.post(location.pathname, {active_div: "machine_instruction", action_type: action_type, "machine_id": machine_id}, function (j) {
1120
+ if (j.machines) {
1121
+ Status.pack_machine_component("machine_instruction_machine", j.machines);
1122
+ if (machine_id) {
1123
+ $("#machine_instruction_machine").val(machine_id);
1124
1124
  }
1125
1125
  }
1126
- if (j["instructions"]) {
1126
+ if (j.instructions) {
1127
1127
  let instruction_html = [];
1128
- j["instructions"].forEach(function (instruction) {
1128
+ j.instructions.forEach(function (instruction) {
1129
1129
  instruction_html.push("<option value='", instruction, "'>", instruction, "</option>");
1130
1130
  });
1131
1131
  $("#machine_instruction_content").html(instruction_html.join(""));
1132
1132
  }
1133
+ let handle_instruction = j.instruction ? ("&nbsp;(" + j.instruction + ")") : "";
1134
+ $("#machine_instruction_modal_title_tips").html(handle_instruction);
1133
1135
  Util.hide_tips();
1134
1136
  });
1135
1137
  });
@@ -1151,11 +1153,12 @@ $(function () {
1151
1153
  $("#machine_instruction_add").attr("disabled", true);
1152
1154
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, action_type: action_type}, function (j) {
1153
1155
  $("#machine_instruction_add").attr("disabled", false);
1154
- if (j["code"] === 1) {
1156
+ if (j.code === 1) {
1155
1157
  $("#machine_instruction_tips").html("<b class='text-success'>任务`" + instruction + "`添加成功!</b>");
1156
- } else if (j["code"] === 2) {
1158
+ $("#machine_instruction_modal_title_tips").html("&nbsp;(" + instruction + ")");
1159
+ } else if (j.code === 2) {
1157
1160
  $("#machine_instruction_tips").html("<b class='text-danger'>Machine 不存在!</b>");
1158
- } else if (j["code"] === 3) {
1161
+ } else if (j.code === 3) {
1159
1162
  $("#machine_instruction_tips").html("<b class='text-danger'>任务内容异常!</b>");
1160
1163
  } else {
1161
1164
  $("#machine_instruction_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
@@ -1205,11 +1208,11 @@ $(function () {
1205
1208
  ccm_obj.on('show.bs.modal', function (e) {
1206
1209
  Util.show_loading();
1207
1210
  Util.post(location.pathname, {active_div: "machine_instruction", action_type: 2}, function (j) {
1208
- if (j["machines"]) {
1209
- Status.pack_machine_component("machine_cookie_machine", j["machines"]);
1210
- let machine = $("#machines").val();
1211
- if (machine) {
1212
- $("#machine_cookie_machine").val(machine);
1211
+ if (j.machines) {
1212
+ Status.pack_machine_component("machine_cookie_machine", j.machines);
1213
+ let machine_id = $("#machines").val();
1214
+ if (machine_id) {
1215
+ $("#machine_cookie_machine").val(machine_id);
1213
1216
  }
1214
1217
  }
1215
1218
  Util.hide_tips();
@@ -1230,9 +1233,9 @@ $(function () {
1230
1233
  $("#machine_cookie_add").attr("disabled", true);
1231
1234
  Util.post(location.pathname, {active_div: "machine_cookie_add", "machine_id": machine_id, "cookie": machine_cookie}, function (j) {
1232
1235
  $("#machine_cookie_add").attr("disabled", false);
1233
- if (j["code"] === 1) {
1236
+ if (j.code === 1) {
1234
1237
  $("#machine_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
1235
- } else if (j["code"] === 2) {
1238
+ } else if (j.code === 2) {
1236
1239
  $("#machine_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
1237
1240
  } else {
1238
1241
  $("#machine_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
@@ -1292,10 +1295,10 @@ $(function () {
1292
1295
  $("#word_value").val("Loading...").attr('readonly', true);
1293
1296
  $("#word_chinese").val("Loading...").attr('readonly', true);
1294
1297
  Util.post(location.pathname, {"active_div": "word_random"}, function (j) {
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>");
1298
+ if (j.word) {
1299
+ $("#word_value").val(j.word);
1300
+ $("#word_chinese").val(j.chinese);
1301
+ $("#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>");
1299
1302
  }
1300
1303
  });
1301
1304
  } else {
@@ -1309,11 +1312,11 @@ $(function () {
1309
1312
  let chinese = $("#word_chinese").val();
1310
1313
  if (chinese) {
1311
1314
  Util.post(location.pathname, {"active_div": "word_modify", "word": word, "chinese": chinese}, function (j) {
1312
- if (j["code"] === 1) {
1313
- $("#word_chinese").val(j["chinese"]);
1314
- $(tr_obj).children('td').eq(2).html(j["chinese"]);
1315
+ if (j.code === 1) {
1316
+ $("#word_chinese").val(j.chinese);
1317
+ $(tr_obj).children('td').eq(2).html(j.chinese);
1315
1318
  $("#word_tips").html("<b class='text-success'>修改成功!</b>");
1316
- } else if (j["code"] === 2) {
1319
+ } else if (j.code === 2) {
1317
1320
  $("#word_tips").html("<b class='text-danger'>中文有误!</b>");
1318
1321
  } else {
1319
1322
  $("#word_tips").html("<b class='text-danger'>修改失败!</b>");
@@ -1378,21 +1381,21 @@ $(function () {
1378
1381
  Util.post("/action", {action: "ip_query", ip: ip}, function (j) {
1379
1382
  $("#ip").prop('disabled', false);
1380
1383
  $("#ip_query").attr("disabled", false);
1381
- if (j["ip"]) {
1382
- if (j["domain"]) {
1384
+ if (j.ip) {
1385
+ if (j.domain) {
1383
1386
  let domain = $("#ip").val().trim();
1384
- j["domain"] = domain ? domain : j["domain"];
1387
+ j.domain = domain ? domain : j.domain;
1385
1388
  }
1386
- $("#ip").val(j["ip"]);
1389
+ $("#ip").val(j.ip);
1387
1390
  let ip_address = Status.convert_ip_address(j);
1388
1391
  if (ip_address.length > 0) {
1389
1392
  let map_url = Status.map_url(ip_address, "<i class='glyphicon glyphicon-map-marker'></i>");
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>");
1393
+ let ip_result = Util.pack_html_link(Status.ip_url(j.ip), "<b class='text-success'>" + ip_address + "</b>") + "&nbsp;&nbsp;&nbsp;" + map_url;
1394
+ 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");
1395
+ ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("https://whois.pconline.com.cn/ipJson.jsp?ip=" + j.ip + "&json=true", "2");
1396
+ ip_result += "&nbsp;&nbsp;&nbsp;" + Util.pack_html_link("http://ip-api.com/json/" + j.ip + "?lang=zh-CN", "3");
1397
+ if (j.domain) {
1398
+ ip_result += "<br><br>" + Util.pack_html_link(j.domain, "<b>" + j.domain + "</b>");
1396
1399
  }
1397
1400
  $("#ip_result").html(ip_result);
1398
1401
  } else {
@@ -1545,7 +1548,7 @@ $(function () {
1545
1548
  Util.post("/action", {action: "phone_query", phone: phone}, function (j) {
1546
1549
  $("#phone").prop('disabled', false);
1547
1550
  $("#phone_query").attr("disabled", false);
1548
- if (j["belong"]) {
1551
+ if (j.belong) {
1549
1552
  let phone_url = Util.pack_html_link("https://www.ip138.com/mobile.asp?mobile=" + phone + "&action=mobile", "<i class='glyphicon glyphicon-link'></i> ");
1550
1553
  $("#phone_result").html(Status.convert_phone(j) + "&nbsp;&nbsp;" + phone_url);
1551
1554
  $("#phone_result a").addClass("text-success");
@@ -1625,7 +1628,7 @@ $(function () {
1625
1628
  referer: $("#search_referer").val()
1626
1629
  };
1627
1630
  Util.post(location.pathname, payload, function (j) {
1628
- Status.render_ip_daily(j["ip_daily_data"]);
1631
+ Status.render_ip_daily(j.ip_daily_data);
1629
1632
  Util.hide_tips();
1630
1633
  });
1631
1634
  $('#ip_modal').modal('hide');
@@ -1698,7 +1701,6 @@ $(function () {
1698
1701
  $("#phone").val(request_arguments["phone"]);
1699
1702
  setTimeout(() => {
1700
1703
  Status.phone_query();
1701
- Enterprise.fetch_enterprise_detail(j["unified_code"]);
1702
1704
  }, 1234);
1703
1705
  }
1704
1706
  } else {