实现批量删除网站功能

This commit is contained in:
GoEdgeLab
2024-01-11 18:40:29 +08:00
parent 2989c5bbcd
commit 8ff13c9117
7 changed files with 107 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
package servers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
// DeleteServersAction 删除一组网站
type DeleteServersAction struct {
actionutils.ParentAction
}
func (this *DeleteServersAction) RunPost(params struct {
ServerIds []int64
}) {
defer this.CreateLogInfo(codes.Server_LogDeleteServers)
_, err := this.RPC().ServerRPC().DeleteServers(this.AdminContext(), &pb.DeleteServersRequest{ServerIds: params.ServerIds})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -19,6 +19,7 @@ func init() {
GetPost("/create", new(CreateAction)).
GetPost("/update", new(UpdateAction)).
Post("/nearby", new(NearbyAction)).
Post("/deleteServers", new(DeleteServersAction)).
//
GetPost("/addPortPopup", new(AddPortPopupAction)).