|
@@ -103,46 +103,50 @@ namespace TEAMModelOS.Filter
|
|
|
}
|
|
|
string ip = IpPort.Split(":")[0];
|
|
|
var path = context.HttpContext.Request.Path;
|
|
|
- string key = $"IES5:BlackList:Token:{id}{school}{scope}:{ip}";
|
|
|
- var BTKExists = _azureRedis.GetRedisClient(8).KeyExists(key);
|
|
|
- if (BTKExists)
|
|
|
- {
|
|
|
- var counts = _azureRedis.GetRedisClient(8).SortedSetScore(key, $"{path}");
|
|
|
- if (counts > 25)
|
|
|
+ if (!$"{path}".Contains("used-space")) {
|
|
|
+ string key = $"IES5:BlackList:Token:{id}{school}{scope}:{ip}";
|
|
|
+ var BTKExists = _azureRedis.GetRedisClient(8).KeyExists(key);
|
|
|
+ if (BTKExists)
|
|
|
{
|
|
|
- pass = false;
|
|
|
- var ttl = _azureRedis.GetRedisClient(8).KeyTimeToLive(key );
|
|
|
- if (ttl.Value.TotalSeconds > 11)
|
|
|
+ var counts = _azureRedis.GetRedisClient(8).SortedSetScore(key, $"{path}");
|
|
|
+ if (counts > 25)
|
|
|
+ {
|
|
|
+ pass = false;
|
|
|
+ var ttl = _azureRedis.GetRedisClient(8).KeyTimeToLive(key);
|
|
|
+ if (ttl.Value.TotalSeconds > 11)
|
|
|
+ {
|
|
|
+ _azureRedis.GetRedisClient(8).KeyExpire(key, new TimeSpan(0, 0, 10));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- _azureRedis.GetRedisClient(8).KeyExpire(key, new TimeSpan(0, 0, 10));
|
|
|
+ _azureRedis.GetRedisClient(8).SortedSetIncrement(key, $"{path}", 1);
|
|
|
+ _azureRedis.GetRedisClient(8).KeyExpire(key, new TimeSpan(0, 1, 0));
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
_azureRedis.GetRedisClient(8).SortedSetIncrement(key, $"{path}", 1);
|
|
|
_azureRedis.GetRedisClient(8).KeyExpire(key, new TimeSpan(0, 1, 0));
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _azureRedis.GetRedisClient(8).SortedSetIncrement(key, $"{path}", 1);
|
|
|
- _azureRedis.GetRedisClient(8).KeyExpire(key, new TimeSpan(0, 1, 0));
|
|
|
- }
|
|
|
- //IP黑名单
|
|
|
- if (!string.IsNullOrWhiteSpace(ip)//&& !ip.Equals("127.0.0.1")
|
|
|
- )
|
|
|
- {
|
|
|
- var BIPExists = _azureRedis.GetRedisClient(8).HashExists("IES5:BlackList:IP", ip);
|
|
|
- if (BIPExists)
|
|
|
+ //IP黑名单
|
|
|
+ if (!string.IsNullOrWhiteSpace(ip)//&& !ip.Equals("127.0.0.1")
|
|
|
+ )
|
|
|
+ {
|
|
|
+ var BIPExists = _azureRedis.GetRedisClient(8).HashExists("IES5:BlackList:IP", ip);
|
|
|
+ if (BIPExists)
|
|
|
+ {
|
|
|
+ pass = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //ID黑名单
|
|
|
+ var BIDExists = _azureRedis.GetRedisClient(8).HashExists("IES5:BlackList:ID", id);
|
|
|
+ if (BIDExists)
|
|
|
{
|
|
|
pass = false;
|
|
|
}
|
|
|
}
|
|
|
- //ID黑名单
|
|
|
- var BIDExists = _azureRedis.GetRedisClient(8).HashExists("IES5:BlackList:ID", id);
|
|
|
- if (BIDExists)
|
|
|
- {
|
|
|
- pass = false;
|
|
|
- }
|
|
|
+
|
|
|
if (pass)
|
|
|
{
|
|
|
context.HttpContext.Items.Add("ID", id);
|