From bf2c27d41528a62dbbe6f99260b7db2e08337123 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 13 Jan 2019 00:45:45 +0800 Subject: [PATCH] update --- plugins/simdht/index.py | 14 +++++++------- plugins/simdht/js/simdht.js | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/simdht/index.py b/plugins/simdht/index.py index 819576e45..0a1ddffe1 100755 --- a/plugins/simdht/index.py +++ b/plugins/simdht/index.py @@ -232,13 +232,12 @@ def isSqlError(mysqlMsg): return None -def getMinData(conn, smin): +def getMinData(conn, sec): time_diff = 0 if public.isAppleSystem(): time_diff = 3 * 60 - pre = time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time() - smin - time_diff)) + time.localtime(time.time() - sec - time_diff)) sql = "select count(id) from search_hash where create_time > '" + pre + "'" data = conn.query(sql) return data[0][0] @@ -251,16 +250,17 @@ def getTrendData(): if not data[0]: return data[1] pdb = pMysqlDb() - interval = int(args['interval']) + # interval = int(args['interval']) result = pdb.execute("show tables") isError = isSqlError(result) if isError: return isError - one = getMinData(pdb, interval) - two = getMinData(pdb, interval * 2) - three = getMinData(pdb, interval * 3) + one = getMinData(pdb, 1) + two = getMinData(pdb, 5) + three = getMinData(pdb, 10) return public.getJson([one, two, three]) except Exception as e: + print str(e) return public.getJson([0, 0, 0]) diff --git a/plugins/simdht/js/simdht.js b/plugins/simdht/js/simdht.js index 0528a6e00..5038f6552 100755 --- a/plugins/simdht/js/simdht.js +++ b/plugins/simdht/js/simdht.js @@ -44,7 +44,7 @@ function dhtTrend(){ } function dhtTrendData(callback){ - dhtPostMin('get_trend_data',{interval:5},function(data){ + dhtPostMin('get_trend_data',{interval:1},function(data){ if(typeof(callback) == 'function'){ callback(data); } @@ -118,7 +118,7 @@ function dhtTrendRender() { trigger: 'axis' }, legend: { - data: ['5s', '10s', '15s'], + data: ['1s', '5s', '10s'], bottom: '2%' }, xAxis: { @@ -145,7 +145,7 @@ function dhtTrendRender() { } }, series: [{ - name: '5s', + name: '1s', type: 'line', data: oneData, smooth: true, @@ -166,7 +166,7 @@ function dhtTrendRender() { normal: {width: 1} } }, { - name: '10s', + name: '5s', type: 'line', data: twoData, smooth: true, @@ -193,7 +193,7 @@ function dhtTrendRender() { } } },{ - name: '15s', + name: '10s', type: 'line', data: threeData, smooth: true, @@ -236,9 +236,9 @@ function dhtTrendRender() { myChartNetwork.setOption({ xAxis: {data: xData}, series: [ - {name: '5s',data: oneData}, - {name: '10s',data: twoData}, - {name: '15s',data: threeData} + {name: '1s',data: oneData}, + {name: '5s',data: twoData}, + {name: '10s',data: threeData} ] }); } @@ -246,7 +246,7 @@ function dhtTrendRender() { renderTick = setInterval(function() { render(); - }, 5000); + }, 2500); checkTick = setInterval(function() { var obj = $('#dht_trend');