mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
增加批量删除IP名单中的IP的功能
This commit is contained in:
37
internal/web/actions/default/servers/iplists/deleteItems.go
Normal file
37
internal/web/actions/default/servers/iplists/deleteItems.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package iplists
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type DeleteItemsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DeleteItemsAction) RunPost(params struct {
|
||||
ItemIds []int64
|
||||
}) {
|
||||
if len(params.ItemIds) == 0 {
|
||||
this.Success()
|
||||
}
|
||||
|
||||
var itemIdStrings = []string{}
|
||||
for _, itemId := range params.ItemIds {
|
||||
itemIdStrings = append(itemIdStrings, types.String(itemId))
|
||||
}
|
||||
|
||||
defer this.CreateLogInfo("批量删除IP名单中的IP:" + strings.Join(itemIdStrings, ", "))
|
||||
|
||||
_, err := this.RPC().IPItemRPC().DeleteIPItems(this.AdminContext(), &pb.DeleteIPItemsRequest{IpItemIds: params.ItemIds})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -21,6 +21,7 @@ func init() {
|
||||
GetPost("/export", new(ExportAction)).
|
||||
Get("/exportData", new(ExportDataAction)).
|
||||
Post("/delete", new(DeleteAction)).
|
||||
Post("/deleteItems", new(DeleteItemsAction)).
|
||||
GetPost("/test", new(TestAction)).
|
||||
GetPost("/update", new(UpdateAction)).
|
||||
Get("/items", new(ItemsAction)).
|
||||
|
||||
Reference in New Issue
Block a user