mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
+14
-1
@@ -24,6 +24,19 @@ class files_api:
|
|||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '').encode('utf-8')
|
||||||
return self.getBody(path)
|
return self.getBody(path)
|
||||||
|
|
||||||
|
def getLastBodyApi(self):
|
||||||
|
path = request.form.get('path', '').encode('utf-8')
|
||||||
|
line = request.form.get('line', 100)
|
||||||
|
|
||||||
|
if not os.path.exists(path):
|
||||||
|
return public.returnJson(False, '文件不存在', (path,))
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = public.getLastLine(path, line)
|
||||||
|
return public.returnJson(True, 'OK', data)
|
||||||
|
except Exception as ex:
|
||||||
|
return public.returnJson(False, u'无法正确读取文件!' + str(ex))
|
||||||
|
|
||||||
def saveBodyApi(self):
|
def saveBodyApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '').encode('utf-8')
|
||||||
data = request.form.get('data', '').encode('utf-8')
|
data = request.form.get('data', '').encode('utf-8')
|
||||||
@@ -70,7 +83,7 @@ class files_api:
|
|||||||
page = request.args.get('p', '1').strip().lower()
|
page = request.args.get('p', '1').strip().lower()
|
||||||
row = request.args.get('showRow', '10')
|
row = request.args.get('showRow', '10')
|
||||||
return self.getDir(path, int(page), int(row), search)
|
return self.getDir(path, int(page), int(row), search)
|
||||||
##### ----- start ----- ###
|
##### ----- end ----- ###
|
||||||
|
|
||||||
def setFileAccept(self, filename):
|
def setFileAccept(self, filename):
|
||||||
auth = 'www:www'
|
auth = 'www:www'
|
||||||
|
|||||||
@@ -1431,7 +1431,7 @@ function pluginOpInitD(a, b) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginLogs(_name, version, func){
|
function pluginLogs(_name, version, func, line){
|
||||||
if ( typeof(version) == 'undefined' ){
|
if ( typeof(version) == 'undefined' ){
|
||||||
version = '';
|
version = '';
|
||||||
}
|
}
|
||||||
@@ -1441,24 +1441,33 @@ function pluginLogs(_name, version, func){
|
|||||||
func_name = func;
|
func_name = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var file_line = 100;
|
||||||
|
if ( typeof(line) != 'undefined' ){
|
||||||
|
file_line = line;
|
||||||
|
}
|
||||||
|
|
||||||
var loadT = layer.msg('错误日志路径获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
|
||||||
|
var loadT = layer.msg('日志路径获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||||
$.post('/plugins/run', {name:_name, func:func_name, version:version},function (data) {
|
$.post('/plugins/run', {name:_name, func:func_name, version:version},function (data) {
|
||||||
layer.close(loadT);
|
layer.close(loadT);
|
||||||
|
|
||||||
var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||||
var fileName = data.data;
|
var fileName = data.data;
|
||||||
$.post('/files/get_body', 'path=' + fileName, function(rdata) {
|
$.post('/files/get_last_body', 'path=' + fileName+'&line'+file_line, function(rdata) {
|
||||||
layer.close(loadT2);
|
layer.close(loadT2);
|
||||||
if (!rdata.status){
|
if (!rdata.status){
|
||||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rdata.data.data == '') rdata.data.data = '当前没有日志!';
|
if(rdata.data == '') {
|
||||||
var ebody = '<div class="soft-man-con"><textarea readonly="" style="margin: 0px;width: 500px;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="error_log">'+rdata.data.data+'</textarea></div>';
|
rdata.data = '当前没有日志!';
|
||||||
|
}
|
||||||
|
var ebody = '<div class="soft-man-con">\
|
||||||
|
<textarea readonly="" style="margin: 0px;width: 500px;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="info_log">'+rdata.data+'</textarea>\
|
||||||
|
</div>';
|
||||||
$(".soft-man-con").html(ebody);
|
$(".soft-man-con").html(ebody);
|
||||||
var ob = document.getElementById('error_log');
|
var ob = document.getElementById('info_log');
|
||||||
ob.scrollTop = ob.scrollHeight;
|
ob.scrollTop = ob.scrollHeight;
|
||||||
},'json');
|
},'json');
|
||||||
},'json');
|
},'json');
|
||||||
|
|||||||
Reference in New Issue
Block a user