mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 02:39:26 +08:00
o
This commit is contained in:
+17
-17
@@ -34,30 +34,30 @@ def M(table):
|
||||
return sql.table(table)
|
||||
|
||||
|
||||
def getWebPage(data, args):
|
||||
def getPage(args, result='1,2,3,4,5,8'):
|
||||
# 取分页
|
||||
import page
|
||||
# 实例化分页类
|
||||
page = page.Page()
|
||||
info = {}
|
||||
info['count'] = len(data)
|
||||
|
||||
info['count'] = 0
|
||||
if args.has_key('count'):
|
||||
info['count'] = int(args['count'])
|
||||
|
||||
info['row'] = 10
|
||||
if hasattr(args, 'row'):
|
||||
if args.has_key('row'):
|
||||
info['row'] = args['row']
|
||||
|
||||
info['p'] = 1
|
||||
if hasattr(args, 'p'):
|
||||
if args.has_key('p'):
|
||||
info['p'] = int(get['p'])
|
||||
info['uri'] = {}
|
||||
info['return_js'] = ''
|
||||
if hasattr(args, 'tojs'):
|
||||
if args.has_key('tojs'):
|
||||
info['return_js'] = args.tojs
|
||||
|
||||
# 获取分页数据
|
||||
result = {}
|
||||
result['page'] = page.GetPage(info)
|
||||
return result
|
||||
return page.GetPage(info, result)
|
||||
|
||||
|
||||
def md5(str):
|
||||
@@ -297,7 +297,7 @@ def getLastLine(inputfile, lineNum):
|
||||
return getMsg('TASK_SLEEP')
|
||||
|
||||
|
||||
def ExecShell(cmdstring, cwd=None, timeout=None, shell=True):
|
||||
def execShell(cmdstring, cwd=None, timeout=None, shell=True):
|
||||
|
||||
if shell:
|
||||
cmdstring_list = cmdstring
|
||||
@@ -321,12 +321,12 @@ def ExecShell(cmdstring, cwd=None, timeout=None, shell=True):
|
||||
def serviceReload():
|
||||
# 重载Web服务配置
|
||||
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:
|
||||
ExecShell('pkill -9 nginx && sleep 1')
|
||||
ExecShell('/etc/init.d/nginx start')
|
||||
execShell('pkill -9 nginx && sleep 1')
|
||||
execShell('/etc/init.d/nginx start')
|
||||
else:
|
||||
result = ExecShell('/etc/init.d/httpd reload')
|
||||
result = execShell('/etc/init.d/httpd reload')
|
||||
return result
|
||||
|
||||
|
||||
@@ -334,9 +334,9 @@ def phpReload(version):
|
||||
# 重载PHP配置
|
||||
import os
|
||||
if os.path.exists('/www/server/php/' + version + '/libphp5.so'):
|
||||
ExecShell('/etc/init.d/httpd reload')
|
||||
execShell('/etc/init.d/httpd reload')
|
||||
else:
|
||||
ExecShell('/etc/init.d/php-fpm-' + version + ' reload')
|
||||
execShell('/etc/init.d/php-fpm-' + version + ' reload')
|
||||
|
||||
|
||||
def downloadFile(url, filename):
|
||||
@@ -797,7 +797,7 @@ def CheckCert(certPath='ssl/certificate.pem'):
|
||||
if tmp1.find('-----BEGIN CERTIFICATE-----') == -1:
|
||||
tmp1 = s + tmp1
|
||||
writeFile(certPath, tmp1)
|
||||
result = ExecShell(openssl + " x509 -in " +
|
||||
result = execShell(openssl + " x509 -in " +
|
||||
certPath + " -noout -subject")
|
||||
if result[1].find('-bash:') != -1:
|
||||
return True
|
||||
|
||||
+4
-1
@@ -20,7 +20,10 @@ dashboard = Blueprint('dashboard', __name__, template_folder='templates')
|
||||
|
||||
@dashboard.route("/")
|
||||
def index():
|
||||
print session['code']
|
||||
|
||||
print(sys.platform)
|
||||
if session.has_key('code'):
|
||||
print session['code']
|
||||
return render_template('default/index.html')
|
||||
|
||||
|
||||
|
||||
+6
-2
@@ -68,8 +68,12 @@ def list():
|
||||
pass
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
||||
+12
-3
@@ -22,7 +22,16 @@ def count():
|
||||
return str(c)
|
||||
|
||||
|
||||
@task.route("/list")
|
||||
@task.route("/list", methods=['GET', 'POST'])
|
||||
def list():
|
||||
c = public.M('tasks').where("status!=?", ('1',)).count()
|
||||
return str(c)
|
||||
_list = public.M('tasks').where('', ()).limit(
|
||||
'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)
|
||||
|
||||
+1
-2
@@ -1765,7 +1765,6 @@ function GetSList(isdisplay) {
|
||||
|
||||
var condition = (search + type + page).slice(1);
|
||||
$.post('/plugins/list?' + condition, '', function(rdata) {
|
||||
//console.log(rdata);
|
||||
layer.close(loadT);
|
||||
var tBody = '';
|
||||
var sBody = '';
|
||||
@@ -1780,7 +1779,7 @@ function GetSList(isdisplay) {
|
||||
}
|
||||
|
||||
$(".softtype").html(tBody);
|
||||
$("#softPage").html(rdata.list.page);
|
||||
$("#softPage").html(rdata.list);
|
||||
$("#softPage .Pcount").css({ "position": "absolute", "left": "0" })
|
||||
|
||||
$(".task").text(rdata.data[rdata.length - 1]);
|
||||
|
||||
Reference in New Issue
Block a user