增加 分组禁用

This commit is contained in:
六零 2022-06-12 02:22:09 +08:00
parent f6aaa16d4f
commit ed6b949ae2
3 changed files with 61 additions and 4 deletions

View File

@ -118,6 +118,16 @@ echo '
$DB->query($delsql1); $DB->query($delsql1);
$DB->query($delsql2); $DB->query($delsql2);
exit(); exit();
} elseif ($set == 'on') {
$id = $_POST['group_id'];
$sql = "UPDATE `lylme_groups` SET `group_status` = '1' WHERE `lylme_groups`.`group_id` =" . $id;
$DB->query($sql);
exit();
} elseif ($set == 'off') {
$id = $_POST['group_id'];
$sql = "UPDATE `lylme_groups` SET `group_status` = '0' WHERE `lylme_groups`.`group_id` =" . $id;
$DB->query($sql);
exit();
} }
elseif ($set == 'sort') { elseif ($set == 'sort') {
for ($i=0; $i<count($_POST["groups"]); $i++) { for ($i=0; $i<count($_POST["groups"]); $i++) {

View File

@ -69,6 +69,47 @@ function save_order(){
}); });
} }
//启用分组
function on_group(id){
lightyear.loading('show');
$.ajax({
url:"group.php?set=on",
method:"POST",
data:{group_id:id},
success:function(data){
lightyear.loading('hide');
lightyear.notify('操作成功!', 'success', 1000);
listTable();
return true;
},
error:function(data){
layer.msg('服务器错误');
lightyear.loading('hide');
return false;
}
});
}
//禁用分组
function off_group(id){
lightyear.loading('show');
$.ajax({
url:"group.php?set=off",
method:"POST",
data:{group_id:id},
success:function(data){
lightyear.loading('hide');
lightyear.notify('操作成功!', 'success', 1000);
listTable();
return true;
},
error:function(data){
layer.msg('服务器错误');
lightyear.loading('hide');
return false;
}
});
}
//删除分组 //删除分组
function del_group(id) { function del_group(id) {
$.confirm({ $.confirm({

View File

@ -6,7 +6,7 @@ if(isset($islogin)==1) {
echo '<div class="alert alert-info">系统共有 <b>' . $groupsrows . '</b> 个分组<br/><a href="./group.php?set=add" class="btn btn-primary">新建分组</a></div> echo '<div class="alert alert-info">系统共有 <b>' . $groupsrows . '</b> 个分组<br/><a href="./group.php?set=add" class="btn btn-primary">新建分组</a></div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead><tr><th>名称</th><th>排序</th><th>链接数</th><th>访问密码</th><th>操作</th></tr></thead> <thead><tr><th>名称</th><th>排序</th><th>链接数</th><th>访问密码</th><th>状态</th><th>操作</th></tr></thead>
<tbody>'; <tbody>';
$sql = " 1"; $sql = " 1";
@ -16,7 +16,6 @@ echo '<div class="alert alert-info">系统共有 <b>' . $groupsrows . '</b> 个
echo '<tr><td><input type="hidden" name="group_id" value="'.$res['group_id'].'">' . $res['group_name'] . '</td><td> echo '<tr><td><input type="hidden" name="group_id" value="'.$res['group_id'].'">' . $res['group_name'] . '</td><td>
<button class="btn btn-primary btn-xs sort-up">上移</button>&nbsp;<button class="btn btn-cyan btn-xs sort-down">下移</button></td> <button class="btn btn-primary btn-xs sort-up">上移</button>&nbsp;<button class="btn btn-cyan btn-xs sort-down">下移</button></td>
<td>'. $DB->num_rows($DB->query("SELECT `id` FROM `lylme_links` WHERE `group_id` =".$res['group_id'])).'</td> <td>'. $DB->num_rows($DB->query("SELECT `id` FROM `lylme_links` WHERE `group_id` =".$res['group_id'])).'</td>
<td>'; <td>';
if($pwd||$res['group_pwd']){ if($pwd||$res['group_pwd']){
if(empty($pwd)){ if(empty($pwd)){
@ -27,8 +26,15 @@ echo '<div class="alert alert-info">系统共有 <b>' . $groupsrows . '</b> 个
} }
} }
else{echo '<font color="green">未加密</font>';} else{echo '<font color="green">未加密</font>';}
echo ' </td> echo ' </td><td>';
<td>&nbsp;<a href="./group.php?set=edit&id=' . $res['group_id'] . '" class="btn btn-info btn-xs">编辑</a>&nbsp;<button class="btn btn-xs btn-danger" onclick="del_group('.$res['group_id'].')">删除</button></td></tr>';
if($res['group_status']){
echo '<button class="btn btn-pink btn-xs" onclick="off_group('.$res['group_id'].')">禁用</button>';
}else{
echo '<button class="btn btn-success btn-xs" onclick="on_group('.$res['group_id'].')">启用</button>';
}
echo'</td><td>&nbsp;<a href="./group.php?set=edit&id=' . $res['group_id'] . '" class="btn btn-info btn-xs">编辑</a>&nbsp;<button class="btn btn-xs btn-danger" onclick="del_group('.$res['group_id'].')">删除</button></td></tr>';
} }
?> ?>