Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Jun 6, 2024
1 parent 679a112 commit 6870dbf
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
44 changes: 44 additions & 0 deletions plugins/clean/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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">';
Expand Down
12 changes: 12 additions & 0 deletions plugins/clean/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -247,5 +257,7 @@ def cleanLog():
print(runLog())
elif func == 'clean':
cleanLog()
elif func == 'clean_run':
print(cleanRun())
else:
print('error')

0 comments on commit 6870dbf

Please sign in to comment.