|
|
@@ -57,6 +57,22 @@ namespace molilian.core
|
|
|
result.reason,
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (ShouldIgnoreRequest(rule.IgnorePercentageCity, ip, oaid, out string reason))
|
|
|
+ {
|
|
|
+ result.success = false;
|
|
|
+ result.message = "放弃转链";
|
|
|
+ result.reason = reason;
|
|
|
+
|
|
|
+ _ = TkLogCore.ParseLogAsync(result);
|
|
|
+ return new APIResult(new
|
|
|
+ {
|
|
|
+ result.success,
|
|
|
+ result.message,
|
|
|
+ result.reason,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
result.channel_id = rule.channel_id;
|
|
|
result.channel_name = rule.channel_name;
|
|
|
|
|
|
@@ -71,9 +87,31 @@ namespace molilian.core
|
|
|
result.deeplink_url,
|
|
|
result.itemName,
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ public static bool ShouldIgnoreRequest(string ignorePercentageCity, string ip, string oaid, out string reason)
|
|
|
+ {
|
|
|
+ reason = string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // IP和流量控制
|
|
|
+ string? ipInfo = IP2RegionPlus.Search(ip);
|
|
|
+ if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
|
|
|
+ {
|
|
|
+ reason = $"地区控制:{regionInfo}";
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ reason = "配置异常";
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public static async Task<DeeplinkParseDataDTO> GenerateDeeplink(string text, DeeplinkParseRuleDTO config, DeeplinkParseDataDTO result)
|
|
|
{
|
|
|
try
|