dodo hold 1 anno fa
parent
commit
e5fce533fd

File diff suppressed because it is too large
+ 0 - 0
molilian.api/Properties/PublishProfiles/https___ccr.ccs.tencentyun.com_shaobin.pubxml.user


+ 9 - 10
molilian.core/Core/taoke/UnionParseCore.cs

@@ -433,17 +433,16 @@ namespace molilian.core
                 var config = TkConfigCore.Get();
 
                 //============================== 放弃转链-地区过滤 ==============================
-                if (accountid == 0 && JdUnionPlus.ShouldIgnoreRequest(config, ip, oaid, out string reason))
+                if (!result.ip.StartsWith("127.0.0") && accountid == 0 && JdUnionPlus.ShouldIgnoreRequest(config, ip, oaid, out string reason))
                 {
                     result.link_type = JdUnionPlus.GetLinkType(result.shortLinkurl, out string out_url, out string itemId);
-                    if (result.link_type == LinkTypeEnum.other_aff)
-                    {
-                        result.deeplink_url = JdUnionPlus.GetDeeplink(result.shortLinkurl);
-                    }
-                    else
+
+                    result.deeplink_url = result.link_type switch
                     {
-                        result.deeplink_url = JdUnionPlus.GetDeeplink(string.Empty);
-                    }
+                        LinkTypeEnum.other_aff or LinkTypeEnum.goods => JdUnionPlus.GetDeeplink(result.shortLinkurl),
+                        _ => JdUnionPlus.GetDeeplink(string.Empty),
+                    };
+
                     result.success = false;
                     result.message = "放弃转链";
                     result.reason = reason;
@@ -470,7 +469,7 @@ namespace molilian.core
                     result.success = false;
                     result.message = "放弃转链";
                     result.reason = "没有匹配账号";
-                    result.deeplink_url = JdUnionPlus.GetDeeplink(string.Empty);
+                    result.deeplink_url = JdUnionPlus.GetDeeplink(result.shortLinkurl);
                     _ = TkLogCore.ParseLogAsync(result);
                     return JdParseOutput(result);
                 }
@@ -507,7 +506,7 @@ namespace molilian.core
                     result.message = "内部错误";
                     result.reason = "转链接口异常";
                 }
-                result.deeplink_url = JdUnionPlus.GetDeeplink(string.Empty);
+                result.deeplink_url = JdUnionPlus.GetDeeplink(result.shortLinkurl);
             }
             _ = TkLogCore.ParseLogAsync(result);
             return JdParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);

+ 16 - 14
molilian.core/Plus/JDUnion/JdUnionPlus.cs

@@ -91,7 +91,7 @@ namespace molilian.core
         public static bool IsAffLlink(string url)
         {
             Uri uri = new(url);
-            if (uri.Host.Equals("u.jd.com", StringComparison.OrdinalIgnoreCase))
+            if (uri.Host.Equals("`u.jd.com", StringComparison.OrdinalIgnoreCase))
             {
                 return true;
             }
@@ -103,7 +103,9 @@ namespace molilian.core
             {
                 WebClientUtility client = new()
                 {
-                    AllowAutoRedirect = false
+                    AllowAutoRedirect = false,
+                    Referer = "http://www.jd.com",
+                    Proxy = ProxyNodesCore.RandomOne()
                 };
                 var response = client.Request(url);
                 if (!response.Successed) return null;
@@ -125,30 +127,30 @@ namespace molilian.core
             itemId = string.Empty;
 
             if (string.IsNullOrEmpty(url)) return LinkTypeEnum.unknown;
-            url = url.ToLower();
+            string lowerUrl = url.ToLower();
 
-            if (url.StartsWith("https://u.jd.com") ||
-                url.StartsWith("http://u.jd.com"))
+            if (lowerUrl.StartsWith("https://u.jd.com") ||
+                lowerUrl.StartsWith("http://u.jd.com"))
                 return LinkTypeEnum.other_aff;
 
-            if (url.StartsWith("https://lives.jd.com/") ||
-                url.StartsWith("http://lives.jd.com/"))
+            if (lowerUrl.StartsWith("https://lives.jd.com/") ||
+                lowerUrl.StartsWith("http://lives.jd.com/"))
                 return LinkTypeEnum.live;
 
-            if (url.StartsWith("https://h5.m.jd.com/active/faxian/video/index.html") ||
-                url.StartsWith("http://h5.m.jd.com/active/faxian/video/index.html"))
+            if (lowerUrl.StartsWith("https://h5.m.jd.com/active/faxian/video/index.html") ||
+                lowerUrl.StartsWith("http://h5.m.jd.com/active/faxian/video/index.html"))
                 return LinkTypeEnum.video;
 
-            if (url.StartsWith("https://eco.m.jd.com/content/dr_home/index.html") ||
-                url.StartsWith("http://eco.m.jd.com/content/dr_home/index.html")) return LinkTypeEnum.profile;
+            if (lowerUrl.StartsWith("https://eco.m.jd.com/content/dr_home/index.html") ||
+                lowerUrl.StartsWith("http://eco.m.jd.com/content/dr_home/index.html")) return LinkTypeEnum.profile;
 
-            if (url.StartsWith("https://3.cn") ||
-                url.StartsWith("http://3.cn"))
+            if (lowerUrl.StartsWith("https://3.cn") ||
+                lowerUrl.StartsWith("http://3.cn"))
             {
                 var target_url = GetDesiredUrl(url);
                 return GetLinkType(target_url, out desiredUrl, out itemId);
             }
-            if (url.Contains("jd.com"))
+            if (lowerUrl.Contains("jd.com"))
             {
                 itemId = GetItemId(url);
                 if (!string.IsNullOrEmpty(itemId)) return LinkTypeEnum.goods;

Some files were not shown because too many files changed in this diff