From 9152fca0c920aa43007ad5b258105c61176c8a8f Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 1 Aug 2019 19:05:30 +0800 Subject: [PATCH] solr delete ok --- plugins/solr/index.py | 16 ++++++++++++++++ plugins/solr/js/solr.js | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/plugins/solr/index.py b/plugins/solr/index.py index 5d617383c..b89c44192 100755 --- a/plugins/solr/index.py +++ b/plugins/solr/index.py @@ -187,6 +187,20 @@ def addCollection(): return public.returnJson(True, '添加成功!:'+retdata[0]) +def removeCollection(): + args = getArgs() + data = checkArgs(args, ['name']) + if not data[0]: + return data[1] + + name = args['name'] + solr_bin = getServerDir() + "/bin/solr" + + retdata = public.execShell(solr_bin + ' delete -c ' + name) + if retdata[1] != "": + return public.returnJson(False, '添加失败!:'+retdata[0]) + return public.returnJson(True, '添加成功!:'+retdata[0]) + # rsyncdReceive if __name__ == "__main__": func = sys.argv[1] @@ -212,5 +226,7 @@ if __name__ == "__main__": print collectionList() elif func == 'add_collection': print addCollection() + elif func == 'remove_collection': + print removeCollection() else: print 'error' diff --git a/plugins/solr/js/solr.js b/plugins/solr/js/solr.js index cd9cdefb2..73d883e83 100755 --- a/plugins/solr/js/solr.js +++ b/plugins/solr/js/solr.js @@ -60,7 +60,7 @@ function collectionManagement(){ '' + list[i]['name']+'' + '\ 命令\ - | 删除\ + | 删除\ '; } @@ -103,6 +103,42 @@ function addCollection(){ }); } +function removeCollection(name){ + var loadOpen = layer.open({ + type: 1, + title: '删除用户', + area: '350px', + content:"
\ +
你要确认要删除collection["+ name + "]
\ +
\ + \ + \ +
\ +
" + }); + + $('#solr_del_close').click(function(){ + layer.close(loadOpen); + }); + + $('#solr_del_ok').click(function(){ + var _data = {}; + _data['name'] = name; + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + + _data = {}; + _data['name'] = name; + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + pPost('remove_collection', _data, function(data){ + var rdata = $.parseJSON(data.data); + layer.close(loadOpen); + layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); + setTimeout(function(){collectionManagement();},2000); + }); + }); + +} + function pRead(){ var readme = '