diff --git a/class/core/plugin.py b/class/core/plugin.py index 7c099db22..b94e56a0a 100755 --- a/class/core/plugin.py +++ b/class/core/plugin.py @@ -68,7 +68,7 @@ class plugin: # 构造本地插件信息 def getPluginInfo(self, info): - print info["checks"] + # print info["checks"] checks = "" if info["checks"][0:1] == "/": diff --git a/class/core/public.py b/class/core/public.py index 21913b0ca..744a70dc4 100755 --- a/class/core/public.py +++ b/class/core/public.py @@ -143,6 +143,14 @@ def returnMsg(status, msg, args=()): return {'status': status, 'msg': msg, 'data': args} +def getInfo(msg, args=()): + # 取提示消息 + for i in range(len(args)): + rep = '{' + str(i + 1) + '}' + msg = msg.replace(rep, args[i]) + return msg + + def getMsg(key, args=()): # 取提示消息 try: diff --git a/class/core/system_api.py b/class/core/system_api.py index adccf22ac..17ed30071 100755 --- a/class/core/system_api.py +++ b/class/core/system_api.py @@ -125,7 +125,12 @@ class system_api: # 取操作系统版本 os = public.getOs() if os == 'darwin': - return os + data = public.execShell('sw_vers')[0] + data_list = data.strip().split("\n") + mac_version = '' + for x in data_list: + mac_version += x.split("\t")[1] + ' ' + return mac_version version = public.readFile('/etc/redhat-release') if not version: @@ -146,7 +151,7 @@ class system_api: days = math.floor(hours / 24) hours = math.floor(hours - (days * 24)) min = math.floor(min - (days * 60 * 24) - (hours * 60)) - return public.getMsg('SYS_BOOT_TIME', (str(int(days)), str(int(hours)), str(int(min)))) + return public.getInfo('已不间断运行: {1}天{2}小时{3}分钟', (str(int(days)), str(int(hours)), str(int(min)))) def getCpuInfo(self, interval=1): # 取CPU信息 diff --git a/static/css/site.css b/static/css/site.css index 70504f87f..46f4c82d9 100755 --- a/static/css/site.css +++ b/static/css/site.css @@ -4363,6 +4363,13 @@ html .menu .menu_exit:hover { background-repeat:no-repeat; padding-left: 20px; } +.ico-mac{ + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAA9ElEQVQ4T5XSvyvGURTH8dej+AsMyGAykEWSTSkyPFJMyvAsYjFZJWZ/gQyKYjEZLcrkRzZZTXomgyzKj3TkW99u6l63bt3OPe/z43NOQ/6sI+5g6trIsMs4wjUm/gs/og+TuMrBA1jAO06wgn3MohfHeKqC1MvexBY6fz/fcI+xWsZXNHEZtgpu4SCvnRfM4KYOn2O6AF7DXr3syB4ldhXAw3hIe/5ERwEc/d+lcBs9BfAOtlM4RrBUAH8hprKLj0rtRZwWwOES4xupqx3vWMHxggDzOEvhftxmer/A1F8bFrYhbKAbh3jGKOYQoq4ituznfAP/VikQF8NdKgAAAABJRU5ErkJggg=="); + background-repeat:no-repeat; + padding-top: 2px; + padding-left: 20px; +} + .index-pos-box{ height: 52px; box-shadow: 0 1px 2px 0 rgba(0,0,0,.1); diff --git a/static/js/index.js b/static/js/index.js index 7744f2182..53be1a15e 100755 --- a/static/js/index.js +++ b/static/js/index.js @@ -122,8 +122,7 @@ function GetPercent(num, total) { function GetDiskInfo() { $.get('/system/disk_info', function(rdata) { - console.log(rdata); - var dBody + var dBody; for (var i = 0; i < rdata.length; i++) { if (rdata[i].path == '/' || rdata[i].path == '/www') { if (rdata[i].size[2].indexOf('M') != -1) { @@ -158,7 +157,7 @@ function GetDiskInfo() { } //清理垃圾 -function ClearSystem() { +function clearSystem() { var loadT = layer.msg('正在清理系统垃圾 ', { icon: 16, time: 0, shade: [0.3, "#000"] }); $.get('/system?action=ClearSystem', function(rdata) { layer.close(loadT); @@ -190,7 +189,23 @@ function getInfo() { setcolor(memPre, "#left", 75, 90, 95); $("#info").html(info.system); $("#running").html(info.time); - $("#core").html(info.cpuNum + " " + '核心'); + var _system = info.system; + if(_system.indexOf("Windows") != -1){ + $(".ico-system").addClass("ico-windows"); + } else if(_system.indexOf("CentOS") != -1) { + $(".ico-system").addClass("ico-centos"); + } else if(_system.indexOf("Ubuntu") != -1) { + $(".ico-system").addClass("ico-ubuntu"); + } else if(_system.indexOf("Debian") != -1) { + $(".ico-system").addClass("ico-debian"); + } else if(_system.indexOf("Fedora") != -1) { + $(".ico-system").addClass("ico-fedora"); + } else if(_system.indexOf("Mac") != -1){ + $(".ico-system").addClass("ico-mac"); + } else { + $(".ico-system").addClass("ico-linux"); + } + $("#core").html(info.cpuNum + ' 核心'); $("#state").html(info.cpuRealUsed); setcolor(memPre, "#state", 30, 70, 90); var memFree = info.memTotal - info.memRealUsed; @@ -246,7 +261,6 @@ function getNet() { setCookie("downNet", net.down); getLoad(net.load); - // console.log(net.mem); // setMemImg(net.mem); setImg(); },'json'); diff --git a/static/js/soft.js b/static/js/soft.js index 2ca786393..c351b5cd4 100755 --- a/static/js/soft.js +++ b/static/js/soft.js @@ -1511,97 +1511,99 @@ function phpmyadmin(msg) { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); }); } + //首页软件列表 -// function indexsoft() { -// var loadT = layer.msg(lan.soft.get_list, { icon: 16, time: 0, shade: [0.3, '#000'] }); -// $.post('/plugin?action=getPluginList', 'display=1', function(rdata) { -// layer.close(loadT); -// var con = ''; -// for (var i = 0; i < rdata['data'].length - 1; i++) { -// var len = rdata.data[i].versions.length; -// var version_info = ''; -// for (var j = 0; j < len; j++) { -// if (rdata.data[i].versions[j].status) continue; -// version_info += rdata.data[i].versions[j].version + '|'; -// } -// if (version_info != '') { -// version_info = version_info.substring(0, version_info.length - 1); -// } -// if (rdata.data[i].display) { -// var isDisplay = false; -// if (rdata.data[i].name != 'php') { -// for (var n = 0; n < len; n++) { -// if (rdata.data[i].versions[n].status == true) { -// isDisplay = true; -// var version = rdata.data[i].versions[n].version; -// if (rdata.data[i].versions[n].run == true) { -// state = '' -// } else { -// state = '' -// } -// } -// } -// if (isDisplay) { -// var clickName = 'SoftMan'; -// if (rdata.data[i].tip == 'lib') { -// clickName = 'PluginMan'; -// version_info = rdata.data[i].title; -// } - -// con += '
\ -// \ -//
\ -//
\ -//
' + rdata.data[i].title + ' ' + version + state + '
\ -//
\ -//
' -// } -// } else { -// for (var n = 0; n < len; n++) { -// if (rdata.data[i].versions[n].status == true) { -// var version = rdata.data[i].versions[n].version; -// if (rdata.data[i].versions[n].run == true) { -// state = '' -// } else { -// state = '' -// } -// } -// if (rdata.data[i].versions[n].display == true) { -// con += '
\ -// \ -//
\ -//
\ -//
' + rdata.data[i].title + ' ' + rdata.data[i].versions[n].version + state + '
\ -//
\ -//
' -// } -// } -// } -// } -// } -// $("#indexsoft").html(con); -// //软件位置移动 -// var softboxlen = $("#indexsoft > div").length; -// var softboxsum = 12; -// var softboxcon = ''; -// var softboxn = softboxlen; -// if (softboxlen <= softboxsum) { -// for (var i = 0; i < softboxsum - softboxlen; i++) { -// softboxn += 1000; -// softboxcon += '
' -// } -// $("#indexsoft").append(softboxcon); -// } -// $("#indexsoft").dragsort({ dragSelector: ".spanmove", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "
" }); - -// function saveOrder() { -// var data = $("#indexsoft > div").map(function() { return $(this).attr("data-id"); }).get(); -// var ssort = data.join("|"); -// $("input[name=list1SortOrder]").val(ssort); -// $.post("/plugin?action=savePluginSort", 'ssort=' + ssort, function(rdata) {}); -// }; -// }); -// } +function indexsoft() { + return; + var loadT = layer.msg('正在获取列表...', { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/plugins/get_plugin_list', 'display=1', function(rdata) { + layer.close(loadT); + var con = ''; + for (var i = 0; i < rdata['data'].length - 1; i++) { + var len = rdata.data[i].versions.length; + var version_info = ''; + for (var j = 0; j < len; j++) { + if (rdata.data[i].versions[j].status) continue; + version_info += rdata.data[i].versions[j].version + '|'; + } + if (version_info != '') { + version_info = version_info.substring(0, version_info.length - 1); + } + if (rdata.data[i].display) { + var isDisplay = false; + if (rdata.data[i].name != 'php') { + for (var n = 0; n < len; n++) { + if (rdata.data[i].versions[n].status == true) { + isDisplay = true; + var version = rdata.data[i].versions[n].version; + if (rdata.data[i].versions[n].run == true) { + state = '' + } else { + state = '' + } + } + } + if (isDisplay) { + var clickName = 'SoftMan'; + if (rdata.data[i].tip == 'lib') { + clickName = 'PluginMan'; + version_info = rdata.data[i].title; + } + + con += '
\ + \ +
\ +
\ +
' + rdata.data[i].title + ' ' + version + state + '
\ +
\ +
' + } + } else { + for (var n = 0; n < len; n++) { + if (rdata.data[i].versions[n].status == true) { + var version = rdata.data[i].versions[n].version; + if (rdata.data[i].versions[n].run == true) { + state = '' + } else { + state = '' + } + } + if (rdata.data[i].versions[n].display == true) { + con += '
\ + \ +
\ +
\ +
' + rdata.data[i].title + ' ' + rdata.data[i].versions[n].version + state + '
\ +
\ +
' + } + } + } + } + } + $("#indexsoft").html(con); + //软件位置移动 + var softboxlen = $("#indexsoft > div").length; + var softboxsum = 12; + var softboxcon = ''; + var softboxn = softboxlen; + if (softboxlen <= softboxsum) { + for (var i = 0; i < softboxsum - softboxlen; i++) { + softboxn += 1000; + softboxcon += '
' + } + $("#indexsoft").append(softboxcon); + } + $("#indexsoft").dragsort({ dragSelector: ".spanmove", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "
" }); + + function saveOrder() { + var data = $("#indexsoft > div").map(function() { return $(this).attr("data-id"); }).get(); + var ssort = data.join("|"); + $("input[name=list1SortOrder]").val(ssort); + $.post("/plugin?action=savePluginSort", 'ssort=' + ssort, function(rdata) {}); + }; + }); +} //插件设置菜单 function PluginMan(name, title) { diff --git a/task.py b/task.py index a116af1ec..edd4e7c18 100755 --- a/task.py +++ b/task.py @@ -119,7 +119,7 @@ def startTask(): "status=?", ('-1',)).setField('status', '0') taskArr = sql.table('tasks').where("status=?", ('0',)).field( 'id,type,execstr').order("id asc").select() - print sql + # print sql for value in taskArr: start = int(time.time()) if not sql.table('tasks').where("id=?", (value['id'],)).count():