Browse Source

fix(aodun): 修复全局限速删除时未删除带宽限制的问题

- 在全局限速删除逻辑中增加了带宽限制的删除步骤
- 对 API 返回消息进行了额外的检查,确保操作成功
fusu 1 tuần trước cách đây
mục cha
commit
d6b837ba65
2 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 3 0
      internal/service/aodun.go
  2. 6 0
      internal/service/api/waf/globallimit.go

+ 3 - 0
internal/service/aodun.go

@@ -368,5 +368,8 @@ func (s *aoDunService) DelBandwidthLimit(ctx context.Context, req v1.Bandwidth)
 	if res.Err != 0 {
 		return fmt.Errorf("API 错误: code %d, msg '%s'", res.Err, res.Msg)
 	}
+	if res.Msg != "操作成功" {
+		return fmt.Errorf("API 错误: code %d, msg '%s'", res.Err, res.Msg)
+	}
 	return nil
 }

+ 6 - 0
internal/service/api/waf/globallimit.go

@@ -400,6 +400,12 @@ func (s *globalLimitService) DeleteGlobalLimit(ctx context.Context, req v1.Globa
 		return err
 	}
 
+	// 删除带宽限制
+	err = s.bulidAudun.Bandwidth(ctx, int64(req.HostId), "del")
+	if err != nil {
+		return err
+	}
+
 	// 黑白IP
 	BwIds, err := s.allowAndDenyRep.GetIpCountListId(ctx, int64(req.HostId))
 	if err != nil {