From 1f5c63ae6953333964eb2276813f3e10f4b98531 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 22 Nov 2018 17:47:19 +0800 Subject: [PATCH] wd --- plugins/redis/js/redis.js | 27 ++++++++++++++++++++------- route/plugins.py | 4 ++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/plugins/redis/js/redis.js b/plugins/redis/js/redis.js index 79d680936..3825806fc 100755 --- a/plugins/redis/js/redis.js +++ b/plugins/redis/js/redis.js @@ -1,8 +1,21 @@ - -function redisService(){ - console.log('redisService'); +//服务 +function redisService(name,status){ + if(status == 'false') status = false; + if(status == 'true') status = true; + + var serviceCon ='

当前状态:'+(status?lan.soft.on:lan.soft.off)+'

\ +
\ + \ + \ + \ +
'; + $(".soft-man-con").html(serviceCon); + var help = ''; + if(name == 'mysqld'){ + $(".soft-man-con").append(help); + } } @@ -16,12 +29,11 @@ function redisStatus() { var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); $.post('/plugins/run', {name:'redis', func:'status'}, function(data) { layer.close(loadT); - if (data.code < 0){ + if (!data.status){ return; } - + var rdata = $.parseJSON(data.data); - hit = (parseInt(rdata.keyspace_hits) / (parseInt(rdata.keyspace_hits) + parseInt(rdata.keyspace_misses)) * 100).toFixed(2); var Con = '
\ \ @@ -46,4 +58,5 @@ function redisStatus() { $(".soft-man-con").html(Con); },'json'); } -redisStatus(); + +redisService('redis', false); diff --git a/route/plugins.py b/route/plugins.py index 88b9225ae..b7e49151a 100644 --- a/route/plugins.py +++ b/route/plugins.py @@ -140,5 +140,5 @@ def run(): data = public.execShell(py) if data[1].strip() == '': - return public.getJson({"data": data[0].strip(), "code": 0}) - return public.getJson({"data": data[1].strip(), "code": -1}) + return public.returnJson(True, "OK", data[0].strip()) + return public.returnJson(False, data[1].strip())