diff --git a/route/static/app/index.js b/route/static/app/index.js index ac198b35c..b19681049 100755 --- a/route/static/app/index.js +++ b/route/static/app/index.js @@ -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:'软件下载中...', - area: '400px', - shadeClose:false, - closeBtn:2, - content:'
' - +'
40% 完成
' - +'
' - +'' - +'' - +'
' - +'
' - }); - 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: "
\
\ -

"+ lan.index.reboot_warning + "

\ +

注意,若您的服务器是一个容器,请取消。

\
\ -

"+ lan.index.reboot_ps + "

\ -

"+ lan.index.reboot_ps_1 + "

\ -

"+ lan.index.reboot_ps_2 + "

\ -

"+ lan.index.reboot_ps_3 + "

\ -

"+ lan.index.reboot_ps_4 + "

\ +

安全重启有利于保障文件安全,将执行以下操作:

\ +

1.停止Web服务

\ +

2.停止MySQL服务

\ +

3.开始重启服务器

\ +

4.等待服务器启动

\
\
\
\ - \ - \ + \ + \
\
" }); @@ -661,21 +637,21 @@ function reBoot() { $(".WSafeRestart").click(function () { var body = '
'; $(".bt-window-restart").html(body); - $(".SafeRestartCode").append("

" + lan.index.reboot_msg_1 + "

"); - bt.pub.set_server_status_by("name={{session['webserver']}}&type=stop", function (r1) { + $(".SafeRestartCode").append("

正在停止Web服务

"); + pluginService('openresty', 'stop', function (r1) { $(".SafeRestartCode p").addClass('c9'); - $(".SafeRestartCode").append("

" + lan.index.reboot_msg_2 + "...

"); - bt.pub.set_server_status_by("name=mysqld&type=stop", function (r2) { + $(".SafeRestartCode").append("

正在停止MySQL服务...

"); + pluginService('mysql','stop', function (r2) { $(".SafeRestartCode p").addClass('c9'); - $(".SafeRestartCode").append("

" + lan.index.reboot_msg_3 + "...

"); - bt.system.root_reload(function (rdata) { + $(".SafeRestartCode").append("

开始重启服务器...

"); + $.post('/system/restart_server', '',function (rdata) { $(".SafeRestartCode p").addClass('c9'); - $(".SafeRestartCode").append("

" + lan.index.reboot_msg_4 + "...

"); + $(".SafeRestartCode").append("

等待服务器启动...

"); var sEver = setInterval(function () { - bt.system.get_total(function () { + $.get("/system/system_total", function(info) { clearInterval(sEver); $(".SafeRestartCode p").addClass('c9'); - $(".SafeRestartCode").append("

" + lan.index.reboot_msg_5 + "...

"); + $(".SafeRestartCode").append("

服务器重启成功!...

"); 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: "
\ - //
\ - //

" + lan.index.reboot_warning + "

\ - //
\ - //

" + lan.index.reboot_ps + "

\ - //

" + lan.index.reboot_ps_1 + "

\ - //

" + lan.index.reboot_ps_2 + "

\ - //

" + lan.index.reboot_ps_3 + "

\ - //

" + lan.index.reboot_ps_4 + "

\ - //
\ - //
\ - //
\ - // \ - // \ - //
\ - //
" - // }) -} - -//重启服务器 -function wSafeRestart() { - var body = '
'; - $(".bt-window-restart").html(body); - var data = "name=" + serverType + "&type=stop"; - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

"); - $.post('/system?action=ServiceAdmin', data, function(r1) { - data = "name=mysqld&type=stop"; - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

" + lan.index.reboot_msg_2 + "...

"); - $.post('/system?action=ServiceAdmin', data, function(r2) { - $(".SafeRestartCode").html("

正在停止" + serverType + "服务

" + lan.index.reboot_msg_2 + "

" + lan.index.reboot_msg_3 + "...

"); - $.post('/system?action=RestartServer', '', function(rdata) { - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

" + lan.index.reboot_msg_2 + "

" + lan.index.reboot_msg_3 + "

" + lan.index.reboot_msg_4 + "...

"); - var sEver = setInterval(function() { - $.get("/system/system_total", function(info) { - clearInterval(sEver); - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

" + lan.index.reboot_msg_2 + "

" + lan.index.reboot_msg_3 + "

" + lan.index.reboot_msg_4 + "

" + lan.index.reboot_msg_5 + "

"); - setTimeout(function() { - layer.closeAll(); - }, 3000); - },'json').error(function() { - - }); - }, 3000); - }).error(function() { - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

" + lan.index.reboot_msg_2 + "

" + lan.index.reboot_msg_3 + "

" + lan.index.reboot_msg_4 + "...

"); - var sEver = setInterval(function() { - $.get("/system/system_total", function(info) { - clearInterval(sEver); - $(".SafeRestartCode").html("

" + lan.index.reboot_msg_1 + "

" + lan.index.reboot_msg_2 + "

" + lan.index.reboot_msg_3 + "

" + lan.index.reboot_msg_4 + "

" + lan.index.reboot_msg_5 + "

"); - 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 }); - }); - }); } //修复面板