From 4341c5b7385998855f14edce6b530499fac17701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 11 Jan 2022 09:46:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BB=E5=8F=96=E5=BD=93?= =?UTF-8?q?=E6=97=A5=E6=8B=A6=E6=88=AA=E6=95=B0API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/rpc/services/service_firewall.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/rpc/services/service_firewall.go b/internal/rpc/services/service_firewall.go index d00d1b04..3c41ddf2 100644 --- a/internal/rpc/services/service_firewall.go +++ b/internal/rpc/services/service_firewall.go @@ -299,3 +299,21 @@ func (this *FirewallService) NotifyHTTPFirewallEvent(ctx context.Context, req *p } return this.Success() } + +// CountFirewallDailyBlocks 读取当前Block动作次数 +func (this *FirewallService) CountFirewallDailyBlocks(ctx context.Context, req *pb.CountFirewallDailyBlocksRequest) (*pb.CountFirewallDailyBlocksResponse, error) { + _, err := this.ValidateAdmin(ctx, 0) + if err != nil { + return nil, err + } + + var tx = this.NullTx() + var day = timeutil.Format("Ymd") + countDailyBlock, err := stats.SharedServerHTTPFirewallDailyStatDAO.SumDailyCount(tx, 0, 0, "block", day, day) + if err != nil { + return nil, err + } + return &pb.CountFirewallDailyBlocksResponse{ + CountBlocks: countDailyBlock, + }, nil +}