This commit is contained in:
Mr Chen
2024-06-06 19:18:44 +08:00
parent 679a112a2c
commit 6870dbf711
2 changed files with 56 additions and 0 deletions
+44
View File
@@ -3,6 +3,7 @@
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('clean');">服务</p>
<p onclick="pluginConfig('clean');">配置修改</p>
<p onclick="commonFunc();">常用功能</p>
<p onclick="pluginLogs('clean',null,'run_log');">运行日志</p>
<p onclick="pRead()">说明</p>
</div>
@@ -12,8 +13,51 @@
</div>
</div>
<script type="text/javascript">
pluginService('clean');
function cleanPost(method, version, args, callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'clean';
req_data['func'] = method;
req_data['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function cleanRun(){
cleanPost('clean_run', '', {}, function(rdata){
var rdata = $.parseJSON(rdata.data);
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
});
}
function commonFunc(){
con = '<hr/><p class="conf_p" style="text-align:center;">\
<button class="btn btn-default btn-sm" onclick="cleanRun()">手动执行</button> \
</p>';
$(".soft-man-con").html(con);
}
function pRead(){
var readme = '<ul class="help-info-text c7">';
+12
View File
@@ -205,6 +205,16 @@ def cleanDirLog(path):
cleanDirLog(abspath)
def cleanRun():
# cleanLog()
plugin_dir = getPluginDir()
# print(plugin_dir)
log_file = getServerDir()+'/clean.log'
cmd = 'python3 '+plugin_dir+'/index.py clean > '+log_file
# print(cmd)
os.system(cmd)
return mw.returnJson(True, '执行成功!')
def cleanLog():
conf = getConf()
clist = mw.readFile(conf).strip()
@@ -247,5 +257,7 @@ if __name__ == "__main__":
print(runLog())
elif func == 'clean':
cleanLog()
elif func == 'clean_run':
print(cleanRun())
else:
print('error')