generated from root/miduo_server
细节优化
parent
e50dd21649
commit
6f48d32ed7
|
|
@ -87,7 +87,11 @@ public class LoginController {
|
|||
if (sessionMaps.isEmpty()){
|
||||
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("state", state);
|
||||
LoginController.addQueue("测试");
|
||||
return "findServerInfo";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,8 +126,6 @@
|
|||
<script type="text/javascript" src="lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var locals = [];
|
||||
|
||||
function conn(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
|
@ -135,14 +133,14 @@
|
|||
url: "/action",
|
||||
success: function (data) {
|
||||
var aObj = document.getElementById("sessions");
|
||||
if (data !== "" && null != data){
|
||||
var list = JSON.parse(data);
|
||||
aObj.innerText = Object.keys(list).length;
|
||||
if (data != "" && null != data){
|
||||
var list = data.split("|");
|
||||
aObj.innerText = list.length+"";
|
||||
aObj.style.color = "red";
|
||||
// 消息体
|
||||
sessionShow(list);
|
||||
}else {
|
||||
aObj.innerText = 0;
|
||||
aObj.innerText = "0";
|
||||
aObj.style.color = "green"
|
||||
}
|
||||
}
|
||||
|
|
@ -150,28 +148,37 @@
|
|||
)
|
||||
}
|
||||
window.setInterval("conn()",1000);
|
||||
|
||||
var arr1 = new Array();
|
||||
|
||||
/**
|
||||
* 展示信息
|
||||
* @param list
|
||||
*/
|
||||
function sessionShow(list) {
|
||||
if (list === "" || list == null){
|
||||
if (list == "" || list == null){
|
||||
return;
|
||||
}
|
||||
// 获取本地存储的消息
|
||||
for (var key in list){
|
||||
if (locals == null || locals[key] == null){
|
||||
var value = list[key];
|
||||
// 创建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);
|
||||
for (j=0,len=list.length;j<len;j++){
|
||||
if (list[j] == "" || list[j] == null){
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
|
|
@ -184,6 +191,7 @@
|
|||
url: "/readAction",
|
||||
success: function () {
|
||||
$(('#li'+id)).html("");
|
||||
arr1.remove(id);
|
||||
conn();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,6 +145,9 @@
|
|||
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0"> 取消 </a>
|
||||
</button>
|
||||
</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>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -211,7 +214,7 @@
|
|||
contentType: 'application/json',
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
alert("修改完成,信息会在一分钟后刷新,请于一分钟后刷新界面查看数据是否正常");
|
||||
layer.msg('修改成功!', {icon: 6, time: 1000});
|
||||
window.location.href="/findServerInfo?quick=0";
|
||||
}
|
||||
if (data === 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue