generated from root/miduo_server
细节优化
parent
e50dd21649
commit
6f48d32ed7
|
|
@ -87,7 +87,11 @@ public class LoginController {
|
||||||
if (sessionMaps.isEmpty()){
|
if (sessionMaps.isEmpty()){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSONObject.toJSONString(sessionMaps);
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> entry : sessionMaps.entrySet()) {
|
||||||
|
builder.append(entry.getKey()).append("#").append(entry.getValue()).append("|");
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ public class ServerInfoController {
|
||||||
}
|
}
|
||||||
map.addAttribute("serverInfos", serverInfoVos);
|
map.addAttribute("serverInfos", serverInfoVos);
|
||||||
map.addAttribute("state", state);
|
map.addAttribute("state", state);
|
||||||
|
LoginController.addQueue("测试");
|
||||||
return "findServerInfo";
|
return "findServerInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,6 @@
|
||||||
<script type="text/javascript" src="lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
|
<script type="text/javascript" src="lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var locals = [];
|
|
||||||
|
|
||||||
function conn(){
|
function conn(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
@ -135,14 +133,14 @@
|
||||||
url: "/action",
|
url: "/action",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var aObj = document.getElementById("sessions");
|
var aObj = document.getElementById("sessions");
|
||||||
if (data !== "" && null != data){
|
if (data != "" && null != data){
|
||||||
var list = JSON.parse(data);
|
var list = data.split("|");
|
||||||
aObj.innerText = Object.keys(list).length;
|
aObj.innerText = list.length+"";
|
||||||
aObj.style.color = "red";
|
aObj.style.color = "red";
|
||||||
// 消息体
|
// 消息体
|
||||||
sessionShow(list);
|
sessionShow(list);
|
||||||
}else {
|
}else {
|
||||||
aObj.innerText = 0;
|
aObj.innerText = "0";
|
||||||
aObj.style.color = "green"
|
aObj.style.color = "green"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,27 +149,36 @@
|
||||||
}
|
}
|
||||||
window.setInterval("conn()",1000);
|
window.setInterval("conn()",1000);
|
||||||
|
|
||||||
|
var arr1 = new Array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 展示信息
|
* 展示信息
|
||||||
* @param list
|
* @param list
|
||||||
*/
|
*/
|
||||||
function sessionShow(list) {
|
function sessionShow(list) {
|
||||||
if (list === "" || list == null){
|
if (list == "" || list == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获取本地存储的消息
|
// 获取本地存储的消息
|
||||||
for (var key in list){
|
for (j=0,len=list.length;j<len;j++){
|
||||||
if (locals == null || locals[key] == null){
|
if (list[j] == "" || list[j] == null){
|
||||||
var value = list[key];
|
continue;
|
||||||
// 创建li,设置内容和id
|
|
||||||
var ele = document.createElement("li");
|
|
||||||
ele.id = "li"+key;
|
|
||||||
ele.innerHTML = "<a href='#' id='"+ key +"' style='color: darkred;' onclick='return readSessions(this)'>"+value+"</a>";
|
|
||||||
// 添加到ul
|
|
||||||
document.getElementById("sessionul").appendChild(ele);
|
|
||||||
}
|
}
|
||||||
|
var split = list[j].split("#");
|
||||||
|
var key = split[0];
|
||||||
|
var index = arr1.indexOf(key);
|
||||||
|
if (index != -1){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var value = split[1];
|
||||||
|
// 创建li,设置内容和id
|
||||||
|
var ele = document.createElement("li");
|
||||||
|
ele.id = "li"+key;
|
||||||
|
ele.innerHTML = "<a href='#' id='"+ key +"' style='color: darkred;' onclick='return readSessions(this)'>"+value+"</a>";
|
||||||
|
// 添加到ul
|
||||||
|
document.getElementById("sessionul").appendChild(ele);
|
||||||
|
arr1.push(key);
|
||||||
}
|
}
|
||||||
locals = list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function readSessions(obj) {
|
function readSessions(obj) {
|
||||||
|
|
@ -184,6 +191,7 @@
|
||||||
url: "/readAction",
|
url: "/readAction",
|
||||||
success: function () {
|
success: function () {
|
||||||
$(('#li'+id)).html("");
|
$(('#li'+id)).html("");
|
||||||
|
arr1.remove(id);
|
||||||
conn();
|
conn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,9 @@
|
||||||
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0"> 取消 </a>
|
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0"> 取消 </a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||||
|
<p style="color: grey;margin: 5px 3px 3px 3px">PS:修改后部分内容不会实时生效,如果发现有数据未发生变化,请耐心等待1-2分钟后刷新界面再查看</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -211,7 +214,7 @@
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data === 1) {
|
if (data === 1) {
|
||||||
alert("修改完成,信息会在一分钟后刷新,请于一分钟后刷新界面查看数据是否正常");
|
layer.msg('修改成功!', {icon: 6, time: 1000});
|
||||||
window.location.href="/findServerInfo?quick=0";
|
window.location.href="/findServerInfo?quick=0";
|
||||||
}
|
}
|
||||||
if (data === 0) {
|
if (data === 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue