pull/109/head
Mr Chen 7 years ago
parent cee8976eb5
commit e3985bb238
  1. 34
      class/core/public.py
  2. 5
      route/dashboard.py
  3. 8
      route/plugins.py
  4. 15
      route/task.py
  5. 3
      static/js/soft.js

@ -34,30 +34,30 @@ def M(table):
return sql.table(table) return sql.table(table)
def getWebPage(data, args): def getPage(args, result='1,2,3,4,5,8'):
# 取分页 # 取分页
import page import page
# 实例化分页类 # 实例化分页类
page = page.Page() page = page.Page()
info = {} info = {}
info['count'] = len(data)
info['count'] = 0
if args.has_key('count'):
info['count'] = int(args['count'])
info['row'] = 10 info['row'] = 10
if hasattr(args, 'row'): if args.has_key('row'):
info['row'] = args['row'] info['row'] = args['row']
info['p'] = 1 info['p'] = 1
if hasattr(args, 'p'): if args.has_key('p'):
info['p'] = int(get['p']) info['p'] = int(get['p'])
info['uri'] = {} info['uri'] = {}
info['return_js'] = '' info['return_js'] = ''
if hasattr(args, 'tojs'): if args.has_key('tojs'):
info['return_js'] = args.tojs info['return_js'] = args.tojs
# 获取分页数据 return page.GetPage(info, result)
result = {}
result['page'] = page.GetPage(info)
return result
def md5(str): def md5(str):
@ -297,7 +297,7 @@ def getLastLine(inputfile, lineNum):
return getMsg('TASK_SLEEP') return getMsg('TASK_SLEEP')
def ExecShell(cmdstring, cwd=None, timeout=None, shell=True): def execShell(cmdstring, cwd=None, timeout=None, shell=True):
if shell: if shell:
cmdstring_list = cmdstring cmdstring_list = cmdstring
@ -321,12 +321,12 @@ def ExecShell(cmdstring, cwd=None, timeout=None, shell=True):
def serviceReload(): def serviceReload():
# 重载Web服务配置 # 重载Web服务配置
if os.path.exists('/www/server/nginx/sbin/nginx'): if os.path.exists('/www/server/nginx/sbin/nginx'):
result = ExecShell('/etc/init.d/nginx reload') result = execShell('/etc/init.d/nginx reload')
if result[1].find('nginx.pid') != -1: if result[1].find('nginx.pid') != -1:
ExecShell('pkill -9 nginx && sleep 1') execShell('pkill -9 nginx && sleep 1')
ExecShell('/etc/init.d/nginx start') execShell('/etc/init.d/nginx start')
else: else:
result = ExecShell('/etc/init.d/httpd reload') result = execShell('/etc/init.d/httpd reload')
return result return result
@ -334,9 +334,9 @@ def phpReload(version):
# 重载PHP配置 # 重载PHP配置
import os import os
if os.path.exists('/www/server/php/' + version + '/libphp5.so'): if os.path.exists('/www/server/php/' + version + '/libphp5.so'):
ExecShell('/etc/init.d/httpd reload') execShell('/etc/init.d/httpd reload')
else: else:
ExecShell('/etc/init.d/php-fpm-' + version + ' reload') execShell('/etc/init.d/php-fpm-' + version + ' reload')
def downloadFile(url, filename): def downloadFile(url, filename):
@ -797,7 +797,7 @@ def CheckCert(certPath='ssl/certificate.pem'):
if tmp1.find('-----BEGIN CERTIFICATE-----') == -1: if tmp1.find('-----BEGIN CERTIFICATE-----') == -1:
tmp1 = s + tmp1 tmp1 = s + tmp1
writeFile(certPath, tmp1) writeFile(certPath, tmp1)
result = ExecShell(openssl + " x509 -in " + result = execShell(openssl + " x509 -in " +
certPath + " -noout -subject") certPath + " -noout -subject")
if result[1].find('-bash:') != -1: if result[1].find('-bash:') != -1:
return True return True

@ -20,7 +20,10 @@ dashboard = Blueprint('dashboard', __name__, template_folder='templates')
@dashboard.route("/") @dashboard.route("/")
def index(): def index():
print session['code']
print(sys.platform)
if session.has_key('code'):
print session['code']
return render_template('default/index.html') return render_template('default/index.html')

@ -68,8 +68,12 @@ def list():
pass pass
ret['data'] = plugins_info ret['data'] = plugins_info
# request.args['row'] = __row_num
ret['list'] = public.getWebPage(plugins_info, request.args) args = {}
args['count'] = len(plugins_info)
args['p1'] = 1
ret['list'] = public.getPage(args)
return jsonify(ret) return jsonify(ret)

@ -22,7 +22,16 @@ def count():
return str(c) return str(c)
@task.route("/list") @task.route("/list", methods=['GET', 'POST'])
def list(): def list():
c = public.M('tasks').where("status!=?", ('1',)).count() _list = public.M('tasks').where('', ()).limit(
return str(c) '0,5').order('id desc').select()
_ret = {}
_ret['data'] = _list
count = public.M('tasks').where('', ()).count()
_page = {}
_page['count'] = count
_ret['page'] = public.getPage(_page)
return public.getJson(_ret)

@ -1765,7 +1765,6 @@ function GetSList(isdisplay) {
var condition = (search + type + page).slice(1); var condition = (search + type + page).slice(1);
$.post('/plugins/list?' + condition, '', function(rdata) { $.post('/plugins/list?' + condition, '', function(rdata) {
//console.log(rdata);
layer.close(loadT); layer.close(loadT);
var tBody = ''; var tBody = '';
var sBody = ''; var sBody = '';
@ -1780,7 +1779,7 @@ function GetSList(isdisplay) {
} }
$(".softtype").html(tBody); $(".softtype").html(tBody);
$("#softPage").html(rdata.list.page); $("#softPage").html(rdata.list);
$("#softPage .Pcount").css({ "position": "absolute", "left": "0" }) $("#softPage .Pcount").css({ "position": "absolute", "left": "0" })
$(".task").text(rdata.data[rdata.length - 1]); $(".task").text(rdata.data[rdata.length - 1]);

Loading…
Cancel
Save