源站增加快速停用/启用功能

This commit is contained in:
GoEdgeLab
2024-04-14 16:29:57 +08:00
parent 86ca7fde55
commit b4625f6abf
3 changed files with 68 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ func init() {
GetPost("/addPopup", new(AddPopupAction)).
Post("/delete", new(DeleteAction)).
GetPost("/updatePopup", new(UpdatePopupAction)).
Post("/updateIsOn", new(UpdateIsOnAction)).
EndAll()
})
}

View File

@@ -0,0 +1,31 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
package origins
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type UpdateIsOnAction struct {
actionutils.ParentAction
}
func (this *UpdateIsOnAction) RunPost(params struct {
OriginId int64
IsOn bool
}) {
defer this.CreateLogInfo(codes.ServerOrigin_LogUpdateOriginIsOn, params.OriginId)
_, err := this.RPC().OriginRPC().UpdateOriginIsOn(this.AdminContext(), &pb.UpdateOriginIsOnRequest{
OriginId: params.OriginId,
IsOn: params.IsOn,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}