Skip to content

Commit

Permalink
gm服务器地址 后台拉取
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpeng committed Sep 25, 2023
1 parent 567c7e9 commit 8779c1c
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions server/center/gm_page.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ return [[
<input id="curServer" type="text" list="curServerList" style="border-radius:5px;" onchange="changeServer()" onfocus="onfocusServer()"/>
<datalist id="curServerList" class="padding: 10px 15px;" >
<option selected hidden disabled value="">下拉选择服务器</option>
<option value ="10.96.8.100">inner</option>
<option value ="10.98.8.59">ycg</option>
<option value ="10.98.8.60">wp</option>
<option value="10.98.8.171">zby</option>
<option value="10.98.8.97">ly</option>
</datalist>
</div>
<div id="consoleTree" class="">
Expand Down Expand Up @@ -119,7 +114,7 @@ return [[
<script type="text/javascript">
function changeServer(){
var tx = "http://" + document.getElementById("curServer").value + ":10301"
var tx = document.getElementById("curServer").value;
window.open(tx, "_self");
}
Expand Down Expand Up @@ -157,6 +152,23 @@ return [[
}
});
//获取服务器列表
var fusion_url = "http://10.98.8.97:18080/server_mgr/query";
// 加载命令列表
$.ajax({
url: fusion_url,
type: "GET",
dataType: "json",
contentType: "utf-8",
success: function (res) {
console.log(JSON.stringify(res));
that._showServers(res);
},
error: function(status) {
document.write(JSON.stringify(status));
}
});
//sendMsg事件
document.getElementById('send').addEventListener('click', function(){
that._sendCommand(historyCmds);
Expand All @@ -178,6 +190,25 @@ return [[
}, false);
},
_showServers: function(res){
var curServerList = document.getElementById('curServerList');
curServerList.value = "";
var host = window.location.host ;
var selectDiv = document.getElementById("curServer");
selectDiv.value = host
for (i = 0; i < res.data.length; i++) {
var option = new Option();
option.innerHTML = res.data[i].name;
option.value = res.data[i].web;
curServerList.appendChild(option);
console.log(option.value)
}
},
_showCommand: function(cmd) {
var inputMsg = document.getElementById('inputMsg');
inputMsg.value = cmd;
Expand Down

0 comments on commit 8779c1c

Please sign in to comment.