Przeglądaj źródła

fix(service): 增加实例过期检查

- 在处理请求时增加对实例过期状态的检查
- 如果实例已过期,返回错误信息"实例已过期"
fusu 3 tygodni temu
rodzic
commit
7835831b39
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      internal/service/wafformatter.go

+ 10 - 0
internal/service/wafformatter.go

@@ -115,6 +115,16 @@ func (s *wafFormatterService) Require(ctx context.Context, req v1.GlobalRequire)
 	if err != nil {
 		return RequireResponse{}, err
 	}
+
+	// 检查是否过期
+	expired, err := s.host.CheckExpired(ctx, int64(req.Uid), int64(req.HostId))
+	if err != nil {
+		return RequireResponse{}, err
+	}
+	if expired {
+		return RequireResponse{}, fmt.Errorf("实例已过期")
+	}
+
 	return res, nil
 }