mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Update index.js
This commit is contained in:
+31
-139
@@ -557,14 +557,6 @@ function updateVersion(version) {
|
||||
$("#btversion").html(version);
|
||||
$("#toUpdate").html('');
|
||||
}
|
||||
|
||||
updateStatus();
|
||||
// layer.msg(lan.index.update_ok, { icon: 1 });
|
||||
// $.get('/system?action=ReWeb', function() {});
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// }, 3000);
|
||||
|
||||
},'json').error(function() {
|
||||
layer.msg('更新失败,请重试!', { icon: 2 });
|
||||
setTimeout(function() {
|
||||
@@ -573,37 +565,21 @@ function updateVersion(version) {
|
||||
});
|
||||
}
|
||||
|
||||
function updateStatus(){
|
||||
layer.open({
|
||||
type:1,
|
||||
title:'<span class="badge badge-inverse">软件下载中...</span>',
|
||||
area: '400px',
|
||||
shadeClose:false,
|
||||
closeBtn:2,
|
||||
content:'<div class="setchmod bt-form pd20 pb70">'
|
||||
+'<div class="progress"><div id="up_download_progress" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"><span class="sr-only">40% 完成</span></div></div>'
|
||||
+'<div class="bt-form-submit-btn">'
|
||||
+'<button type="button" class="btn btn-danger btn-sm btn-title" onclick="layer.closeAll()">取消</button>'
|
||||
+'<button type="button" class="btn btn-success btn-sm btn-title" onclick="updateInstall()" >确认安装</button>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
});
|
||||
|
||||
var t = setInterval(function(){
|
||||
$.get('/system/update_server?type=update_status', function(rdata) {
|
||||
console.log(rdata);
|
||||
$('#up_download_progress').css('width',rdata.data+"%");
|
||||
if (rdata.data ==100){
|
||||
clearInterval(t);
|
||||
}
|
||||
|
||||
},'json');
|
||||
},1000);
|
||||
function pluginService(pname,pfunc, callback){
|
||||
$.post('/plugins/run', {name:'openresty', func:pfunc}, function(data) {
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function updateInstall(){
|
||||
|
||||
}
|
||||
|
||||
//重启服务器
|
||||
function reBoot() {
|
||||
@@ -621,7 +597,7 @@ function reBoot() {
|
||||
var type = $(this).attr('data-id');
|
||||
switch (type) {
|
||||
case 'panel':
|
||||
layer.confirm('即将重启面板服务,继续吗?', { title: lan.index.panel_reboot_title, closeBtn: 2, icon: 3 }, function () {
|
||||
layer.confirm('即将重启面板服务,继续吗?', { title: '重启面板服务', closeBtn: 2, icon: 3 }, function () {
|
||||
var loadT = layer.load();
|
||||
$.post('/system/restart','',function (rdata) {
|
||||
layer.close(loadT);
|
||||
@@ -631,26 +607,26 @@ function reBoot() {
|
||||
});
|
||||
break;
|
||||
case 'server':
|
||||
var rebootbox = bt.open({
|
||||
var rebootbox = layer.open({
|
||||
type: 1,
|
||||
title: lan.index.reboot_title,
|
||||
title: '安全重启服务器',
|
||||
area: ['500px', '280px'],
|
||||
closeBtn: 2,
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form bt-window-restart'>\
|
||||
<div class='pd15'>\
|
||||
<p style='color:red; margin-bottom:10px; font-size:15px;'>"+ lan.index.reboot_warning + "</p>\
|
||||
<p style='color:red; margin-bottom:10px; font-size:15px;'>注意,若您的服务器是一个容器,请取消。</p>\
|
||||
<div class='SafeRestart' style='line-height:26px'>\
|
||||
<p>"+ lan.index.reboot_ps + "</p>\
|
||||
<p>"+ lan.index.reboot_ps_1 + "</p>\
|
||||
<p>"+ lan.index.reboot_ps_2 + "</p>\
|
||||
<p>"+ lan.index.reboot_ps_3 + "</p>\
|
||||
<p>"+ lan.index.reboot_ps_4 + "</p>\
|
||||
<p>安全重启有利于保障文件安全,将执行以下操作:</p>\
|
||||
<p>1.停止Web服务</p>\
|
||||
<p>2.停止MySQL服务</p>\
|
||||
<p>3.开始重启服务器</p>\
|
||||
<p>4.等待服务器启动</p>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-danger btn-sm btn-reboot'>"+ lan.public.cancel + "</button>\
|
||||
<button type='button' class='btn btn-success btn-sm WSafeRestart' >"+ lan.public.ok + "</button>\
|
||||
<button type='button' class='btn btn-danger btn-sm btn-reboot'>取消</button>\
|
||||
<button type='button' class='btn btn-success btn-sm WSafeRestart' >确定</button>\
|
||||
</div>\
|
||||
</div>"
|
||||
});
|
||||
@@ -661,21 +637,21 @@ function reBoot() {
|
||||
$(".WSafeRestart").click(function () {
|
||||
var body = '<div class="SafeRestartCode pd15" style="line-height:26px"></div>';
|
||||
$(".bt-window-restart").html(body);
|
||||
$(".SafeRestartCode").append("<p>" + lan.index.reboot_msg_1 + "</p>");
|
||||
bt.pub.set_server_status_by("name={{session['webserver']}}&type=stop", function (r1) {
|
||||
$(".SafeRestartCode").append("<p>正在停止Web服务</p>");
|
||||
pluginService('openresty', 'stop', function (r1) {
|
||||
$(".SafeRestartCode p").addClass('c9');
|
||||
$(".SafeRestartCode").append("<p>" + lan.index.reboot_msg_2 + "...</p>");
|
||||
bt.pub.set_server_status_by("name=mysqld&type=stop", function (r2) {
|
||||
$(".SafeRestartCode").append("<p>正在停止MySQL服务...</p>");
|
||||
pluginService('mysql','stop', function (r2) {
|
||||
$(".SafeRestartCode p").addClass('c9');
|
||||
$(".SafeRestartCode").append("<p>" + lan.index.reboot_msg_3 + "...</p>");
|
||||
bt.system.root_reload(function (rdata) {
|
||||
$(".SafeRestartCode").append("<p>开始重启服务器...</p>");
|
||||
$.post('/system/restart_server', '',function (rdata) {
|
||||
$(".SafeRestartCode p").addClass('c9');
|
||||
$(".SafeRestartCode").append("<p>" + lan.index.reboot_msg_4 + "...</p>");
|
||||
$(".SafeRestartCode").append("<p>等待服务器启动...</p>");
|
||||
var sEver = setInterval(function () {
|
||||
bt.system.get_total(function () {
|
||||
$.get("/system/system_total", function(info) {
|
||||
clearInterval(sEver);
|
||||
$(".SafeRestartCode p").addClass('c9');
|
||||
$(".SafeRestartCode").append("<p>" + lan.index.reboot_msg_5 + "...</p>");
|
||||
$(".SafeRestartCode").append("<p>服务器重启成功!...</p>");
|
||||
setTimeout(function () {
|
||||
layer.closeAll();
|
||||
}, 3000);
|
||||
@@ -689,90 +665,6 @@ function reBoot() {
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// layer.open({
|
||||
// type: 1,
|
||||
// title: lan.index.reboot_title,
|
||||
// area: ['500px', '280px'],
|
||||
// closeBtn: 2,
|
||||
// shadeClose: false,
|
||||
// content: "<div class='bt-form bt-window-restart'>\
|
||||
// <div class='pd15'>\
|
||||
// <p style='color:red; margin-bottom:10px; font-size:15px;'>" + lan.index.reboot_warning + "</p>\
|
||||
// <div class='SafeRestart' style='line-height:26px'>\
|
||||
// <p>" + lan.index.reboot_ps + "</p>\
|
||||
// <p>" + lan.index.reboot_ps_1 + "</p>\
|
||||
// <p>" + lan.index.reboot_ps_2 + "</p>\
|
||||
// <p>" + lan.index.reboot_ps_3 + "</p>\
|
||||
// <p>" + lan.index.reboot_ps_4 + "</p>\
|
||||
// </div>\
|
||||
// </div>\
|
||||
// <div class='bt-form-submit-btn'>\
|
||||
// <button type='button' id='web_end_time' class='btn btn-danger btn-sm btn-title' onclick='layer.closeAll()'>" + lan.public.cancel + "</button>\
|
||||
// <button type='button' id='web_del_send' class='btn btn-success btn-sm btn-title' onclick='WSafeRestart()'>" + lan.public.ok + "</button>\
|
||||
// </div>\
|
||||
// </div>"
|
||||
// })
|
||||
}
|
||||
|
||||
//重启服务器
|
||||
function wSafeRestart() {
|
||||
var body = '<div class="SafeRestartCode pd15" style="line-height:26px"></div>';
|
||||
$(".bt-window-restart").html(body);
|
||||
var data = "name=" + serverType + "&type=stop";
|
||||
$(".SafeRestartCode").html("<p>" + lan.index.reboot_msg_1 + "</p>");
|
||||
$.post('/system?action=ServiceAdmin', data, function(r1) {
|
||||
data = "name=mysqld&type=stop";
|
||||
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p>" + lan.index.reboot_msg_2 + "...</p>");
|
||||
$.post('/system?action=ServiceAdmin', data, function(r2) {
|
||||
$(".SafeRestartCode").html("<p class='c9'>正在停止" + serverType + "服务</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p>" + lan.index.reboot_msg_3 + "...</p>");
|
||||
$.post('/system?action=RestartServer', '', function(rdata) {
|
||||
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>");
|
||||
var sEver = setInterval(function() {
|
||||
$.get("/system/system_total", function(info) {
|
||||
clearInterval(sEver);
|
||||
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>");
|
||||
setTimeout(function() {
|
||||
layer.closeAll();
|
||||
}, 3000);
|
||||
},'json').error(function() {
|
||||
|
||||
});
|
||||
}, 3000);
|
||||
}).error(function() {
|
||||
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>");
|
||||
var sEver = setInterval(function() {
|
||||
$.get("/system/system_total", function(info) {
|
||||
clearInterval(sEver);
|
||||
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>");
|
||||
setTimeout(function() {
|
||||
layer.closeAll();
|
||||
window.location.reload();
|
||||
}, 3000);
|
||||
|
||||
},'json').error(function() {
|
||||
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
});
|
||||
$(".layui-layer-close").unbind("click");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//屏蔽指定IP
|
||||
function dropAddress(address) {
|
||||
layer.confirm(lan.index.net_doup_ip_msg, { icon: 3, closeBtn: 2 }, function() {
|
||||
loadT = layer.msg(lan.index.net_doup_ip_to, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/firewall?action=AddDropAddress', 'port=' + address + '&ps=' + lan.index.net_doup_ip_ps, function(rdata) {
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//修复面板
|
||||
|
||||
Reference in New Issue
Block a user