You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
7.2 KiB

1 month ago
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<script src="/js/guid.js"></script>
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
<script type="text/javascript" src="../js/load_realmlist.js"></script>
<!--#include file="/widget/head.html"-->
<style>
.ws-docs-anim > div {
padding: 16px;
transition: all .3s;
}
.ws-docs-anim > div:hover {
background-color: #f2f2f2;
color: #000;
}
.ws-docs-anim > div .layui-anim {
width: 125px;
height: 125px;
line-height: 125px;
margin: 0 auto 10px;
text-align: center;
background-color: #16baaa;
cursor: pointer;
color: #fff;
border-radius: 50%;
user-select: none;
}
.ws-docs-anim > div > div {
text-align: center;
white-space: nowrap;
}
</style>
</head>
<body class="layui-layout-body" layadmin-themealias="default" id="LAY_app_body">
<div id="wrapper" class="layui-fluid">
<!--#include file="/widget/nav.html"-->
<div id="page-wrapper" class="layui-body layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15">
<div class="layui-card">
<div class="layui-card-header">
<h2>网关连接数查询</h2>
</div>
<div class=" layui-form layui-row layui-col-space10">
<div class="layui-col-md8">
<div class="form-group">
<div class="col-md-1">
<label>网关名称:</label>
</div>
<div class="form-group col-md-3">
<select class="form-control" id="dbName" lay-search lay-filter>
<option value="All">所有数据</option>
<option value="gate_game">游戏服</option>
<option value="gate_chat">聊天服</option>
<option value="gate_account">账号服</option>
<option value="gate_version">版本服</option>
</select>
</div>
<button type="button" class=" layui-btn " id="sele">查询</button>
</div>
<div class="layui-card-body">
<div class="layui-row ws-docs-anim" id="listId">
</div>
<script>
layui.use(function () {
var $ = layui.$;
//演示动画
$('.ws-docs-anim .layui-anim').on('click', function () {
var othis = $(this), anim = othis.data('anim');
//停止循环
if (othis.hasClass('layui-anim-loop')) {
return othis.removeClass(anim);
}
othis.removeClass(anim);
setTimeout(function () {
othis.addClass(anim);
});
//恢复渐隐
if (anim === 'layui-anim-fadeout') {
setTimeout(function () {
othis.removeClass(anim);
}, 1300);
}
});
});
</script>
</div>
<div class="layui-card-body">
<pre id='preId' style="white-space: pre-line;"></pre>
<div id="dataTableDiv">
<table class="layui-table" id="dataTable"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--#include file="/widget/tail.html"-->
<script type="text/javascript">
const fileBasePath = "../log";
$("#sele").click(function () {
var dbName = $("#dbName").select().val();
var loadIndex = layer.load(0);
let timeout = true;
setTimeout(() => {
layer.close(loadIndex)
if (timeout) {
layer.msg("request timeout");
}
}, 5000);
$.get(Page.SvrIp + "/api/gate_monitor",
{
token: cookie.get("token"),
gateName: dbName,
basePath: fileBasePath
},
function (d) {
timeout = false;
layer.close(loadIndex)
debugger
if (d.code == 0) {
if (d.type == 1) {
// $("#preId").show();
//document.getElementById('preId').innerHTML = d.data;
let html = ' <div class="layadmin-tabsbody-item layui-show layui-layout"> <div class="layui-fluid layadmin-maillist-fluid">\n' +
' <div class="layui-row layui-col-space15">';
$("#listId").html("")
let json = JSON.parse(d.data)
let tail = "";
for (const jsonKey in json) {
let item = json[jsonKey]
html +=
' <div class="layui-col-md2 layui-col-sm3"><div class="layadmin-contact-box">' +
'<div class="layui-col-sm3">\n' +
' <div class="layui-anim" data-anim="layui-anim-downbit">连接数:' + item.onlinePlayer + '</div>\n' +
' <div style="align-items: center; display: flex;">' + item.name + '</div>\n' +
' </div> ' +
'</div></div>'
tail += item.tail;
}
html += '</div></div></div>';
$("#listId").html(html)
$("#preId").show();
document.getElementById('preId').innerHTML = tail;
} else {
var data = JSON.stringify(d.data, null, 4);
document.getElementById('preId').innerHTML = data;
//$("#preId").show();
}
} else {
layer.alert('输入错误,请检查', {icon: 2});
$("#preId").val('');
}
}
);
});
var packageIds
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
$(function () {
// Load_realmlist();
});
</script>
<script src="../js/coupon.js"></script>
</div>
</body>
</html>