Files
EdgeAdmin/internal/web/actions/default/servers/iplists/deleteItems.go
2021-11-21 09:43:14 +08:00

38 lines
876 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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()
}