From 0c31eb930b095a985db27b31affed6b4404c5df5 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 4 Dec 2018 19:38:27 +0800 Subject: [PATCH] up --- class/core/public.py | 14 ++++++++------ class/core/system_api.py | 5 ++++- static/js/index.js | 24 ++++++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/class/core/public.py b/class/core/public.py index c05a4deec..8aa6ad7a4 100755 --- a/class/core/public.py +++ b/class/core/public.py @@ -467,14 +467,16 @@ def isUpdateLocalSoft(): num = M('tasks').where('status!=?', ('1',)).count() - if num == 0: + if os.path.exists('mdserver-web.zip'): return True - data = M('tasks').where('status!=?', ('1',)).field( - 'id,type,execstr').limit('1').select() - argv = data[0]['execstr'].split('|dl|') - if data[0]['type'] == 'download' and argv[1] == 'mdserver-web.zip': - return True + if num > 0: + data = M('tasks').where('status!=?', ('1',)).field( + 'id,type,execstr').limit('1').select() + argv = data[0]['execstr'].split('|dl|') + if data[0]['type'] == 'download' and argv[1] == 'mdserver-web.zip': + return True + return False diff --git a/class/core/system_api.py b/class/core/system_api.py index 3abdcecfe..dec837773 100755 --- a/class/core/system_api.py +++ b/class/core/system_api.py @@ -553,13 +553,16 @@ class system_api: try: if public.isUpdateLocalSoft(): + if stype == 'check' or stype == 'info' or stype == 'update': + return public.returnJson(True, '正在安装中...', 'download') if stype == 'update_status': + if os.path.exists('mdserver-web.zip'): + return public.returnJson(True, '进度!', 100) data = public.readFile('tmp/panelExec.log') if data == 'done': return public.returnJson(True, '进度!', 100) else: _data = json.loads(data) - return public.returnJson(True, '进度!', _data['pre']) if not public.isRestart(): diff --git a/static/js/index.js b/static/js/index.js index 940925156..493dde1c3 100755 --- a/static/js/index.js +++ b/static/js/index.js @@ -491,6 +491,11 @@ function checkUpdate() { var loadT = layer.msg(lan.index.update_get, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.get('/system/update_server?type=check', function(rdata) { layer.close(loadT); + + if (rdata.data == 'download'){ + updateStatus();return; + } + if (rdata.status === false) { layer.confirm(rdata.msg, { title: lan.index.update_check, icon: 1, closeBtn: 2, btn: [lan.public.know, lan.public.close] }); return; @@ -503,6 +508,10 @@ function checkUpdate() { function updateMsg(){ $.get('/system/update_server?type=info',function(rdata){ + if (rdata.data == 'download'){ + updateStatus();return; + } + var v = rdata.data.version; var v_info = ''; if (v.split('.').length>3){ @@ -533,6 +542,11 @@ function updateMsg(){ function updateVersion(version) { var loadT = layer.msg('正在升级面板..', { icon: 16, time: 0, shade: [0.3, '#000'] }); $.get('/system/update_server?type=update&version='+version, function(rdata) { + + if (rdata.data == 'download'){ + updateStatus();return; + } + layer.closeAll(); if (rdata.status === false) { layer.msg(rdata.msg, { icon: 5, time: 5000 }); @@ -567,11 +581,10 @@ function updateStatus(){ shadeClose:false, closeBtn:2, content:'
' - +'
40% 完成
' - // +'

1231231

' + +'
40% 完成
' +'
' +'' - +'' + +'' +'
' +'
' }); @@ -586,13 +599,12 @@ function updateStatus(){ },'json'); },1000); - - +} +function updateInstall(){ } - //重启服务器 function ReBoot() { layer.open({