Переглянути джерело

✨ feat(代理): 新增代理节点列表

dodo hold 3 місяців тому
батько
коміт
7b405042c4

+ 2 - 2
molilian.api/Controllers/admin/JdUnionController.cs

@@ -252,7 +252,7 @@ namespace molilian.api.Controllers
             if (!show_hide) filter = "is_hide=0";
             if (!string.IsNullOrEmpty(keyword))
             {
-                filter += $" AND (`name` LIKE @keyword OR `description` LIKE @keyword)";
+                filter += $" AND (`name` LIKE @keyword OR `pin` LIKE @keyword OR `nodename` LIKE @keyword OR `company` LIKE @keyword OR `description` LIKE @keyword)";
                 keyword = $"%{keyword}%";
             }
             DateTime stime = DateTime.MinValue, etime = DateTime.MinValue;
@@ -280,7 +280,7 @@ namespace molilian.api.Controllers
                 orderBy = sort switch
                 {
                     //"num" => $"num {order}",
-                    _ => $"{sort} {order}",
+                    _ => $"{sort} {order}, id DESC",
                 };
             }
 

+ 8 - 7
molilian.api/Controllers/admin/PddUnionController.cs

@@ -1,12 +1,14 @@
-using molilian.core;
 using dodohold.core;
 using Microsoft.AspNetCore.Mvc;
-using System.Text.Json;
-using System.Net;
-using static QRCoder.PayloadGenerator;
+using molilian.core;
 using MySqlX.XDevAPI;
 using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System.Net;
+using System.Text.Json;
+using System.Xml.Linq;
+using TencentCloud.Mrs.V20200910.Models;
 using WebSocketSharp.Net;
+using static QRCoder.PayloadGenerator;
 namespace molilian.api.Controllers
 {
 
@@ -79,7 +81,7 @@ namespace molilian.api.Controllers
             if (!show_hide) filter = "is_hide=0";
             if (!string.IsNullOrEmpty(keyword))
             {
-                filter += $" AND (`name` LIKE @keyword OR `description` LIKE @keyword)";
+                filter += $" AND (`name` LIKE @keyword OR `duoId` LIKE @keyword OR `pid` LIKE @keyword OR `nodename` LIKE @keyword OR `company` LIKE @keyword OR `description` LIKE @keyword)";
                 keyword = $"%{keyword}%";
             }
             DateTime stime = DateTime.MinValue, etime = DateTime.MinValue;
@@ -94,7 +96,6 @@ namespace molilian.api.Controllers
             if (status != -1)
             {
                 filter += $" AND status=@status";
-
             }
 
             filter = filter.StringTrimStart(" AND ");
@@ -107,7 +108,7 @@ namespace molilian.api.Controllers
                 orderBy = sort switch
                 {
                     //"num" => $"num {order}",
-                    _ => $"{sort} {order}",
+                    _ => $"{sort} {order}, id DESC",
                 };
             }
 

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 38 - 19
molilian.core/Core/pdd/PddPoolCore.cs

@@ -38,15 +38,23 @@ namespace molilian.core
             _end_point = Environment.GetEnvironmentVariable("EndPoint");
         }
 
-        /// <summary>
-        /// 获取一个账号用于处理请求
-        /// 使用平滑加权轮询算法(Smooth Weighted Round-Robin)实现流量均衡分配
-        /// </summary>
-        public static PddPoolDTO? GetOne(PddUnionWorkMode mode, int accountid = 0, string parse_type = "")
-        {
-            var list = List();
-            if (!list.Any()) return null;
-
+        /// <summary>
+        /// 获取一个账号用于处理请求
+        /// 使用平滑加权轮询算法(Smooth Weighted Round-Robin)实现流量均衡分配
+        /// </summary>
+        public static PddPoolDTO? GetOne(PddUnionWorkMode mode, int accountid = 0, string parse_type = "")
+        {
+            return GetOne(mode, new UnionParseRequest
+            {
+                AccountId = accountid
+            }, parse_type);
+        }
+
+        public static PddPoolDTO? GetOne(PddUnionWorkMode mode, UnionParseRequest request, string parse_type = "")
+        {
+            var list = List();
+            if (!list.Any()) return null;
+
             // 按 parse_type 过滤
             if ("dp".Equals(parse_type))
             {
@@ -54,16 +62,27 @@ namespace molilian.core
                 if (!list.Any()) return null;
             }
             else
-            {
-                list = list.Where(item => string.IsNullOrEmpty(item.parse_type)).ToList();
-                if (!list.Any()) return null;
-            }
-
-            // 过滤出符合条件的候选账号
-            var candidates = list.Where(e => IsMatch(e, mode, accountid)).ToList();
-            if (!candidates.Any()) return null;
-
-            // 使用平滑加权轮询算法选择账号
+            {
+                list = list.Where(item => string.IsNullOrEmpty(item.parse_type)).ToList();
+                if (!list.Any()) return null;
+            }
+
+            if (!string.IsNullOrEmpty(request.RiskStrategy) && !"os".Equals(request.RiskStrategy) && request.LaunchScene != -1)
+            {
+                list = list.Where(item => request.RiskStrategy.Equals(item.riskStrategy) && item.launchScene == request.LaunchScene).ToList();
+                if (!list.Any()) return null;
+            }
+            else
+            {
+                list = list.Where(item => string.IsNullOrEmpty(item.riskStrategy)).ToList();
+                if (!list.Any()) return null;
+            }
+
+            // 过滤出符合条件的候选账号
+            var candidates = list.Where(e => IsMatch(e, mode, request.AccountId)).ToList();
+            if (!candidates.Any()) return null;
+
+            // 使用平滑加权轮询算法选择账号
             return SmoothWeightedRoundRobin(candidates, parse_type);
         }
 

+ 3 - 4
molilian.core/Core/taoke/UnionParseCore/UnionParseCore.cs

@@ -32,13 +32,12 @@ namespace molilian.core
                     break;
             }
 
-
             switch (request.RiskStrategy)
             {
                 case "tbpush":
                 case "brwsimilar":
                 case "icon":
-                    request.LaunchScene = 0;
+                    if (request.LaunchScene == -1) request.LaunchScene = 0;
                     break;
             }
 
@@ -1351,7 +1350,7 @@ namespace molilian.core
                 // 2. 并发安全的账号预留(Redis SETNX)
                 // 3. 依次尝试多个候选账号
                 // 因此不需要外层重试逻辑
-                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request.AccountId);
+                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request);
 
                 if (account == null)
                 {
@@ -1506,7 +1505,7 @@ namespace molilian.core
                 // 2. 并发安全的账号预留(Redis SETNX)
                 // 3. 依次尝试多个候选账号
                 // 因此不需要外层重试逻辑
-                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request.AccountId);
+                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request);
                 if (account == null)
                 {
                     result.success = false;

+ 1 - 1
molilian.core/Core/taoke/UnionParseCore/dp2dp.cs

@@ -778,7 +778,7 @@ namespace molilian.core
                 // 2. 并发安全的账号预留(Redis SETNX)
                 // 3. 依次尝试多个候选账号
                 // 因此不需要外层重试逻辑
-                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request.AccountId, "dp");
+                account = PddPoolCore.GetOne(PddUnionWorkMode.All, request, "dp");
 
                 if (account == null)
                 {

+ 3 - 0
molilian.core/DTO/pdd/PddDataDTO.cs

@@ -36,6 +36,9 @@
         public int subCode { get; set; } = 0;
         public string accessto { get; set; } = string.Empty;
         public string parse_type { get; set; } = string.Empty;
+        public string riskStrategy { get; set; } = string.Empty;
+        public int launchScene { get; set; } = -1;
+
     }
 
 }

+ 5 - 0
molilian.core/DTO/pdd/PddPoolDTO.cs

@@ -51,5 +51,10 @@ namespace molilian.core
         public bool is_hide { get; set; } = true;
         public bool enable_call_stats { get; set; } = true;
         public string parse_type { get; set; } = string.Empty;
+        public string riskStrategy { get; set; } = string.Empty;
+        public int launchScene { get; set; } = -1;
+
+
+
     }
 }

+ 12 - 0
molilian.core/Plus/pdd/PddUnionPlus.cs

@@ -105,6 +105,16 @@ namespace molilian.core
 
         public static PddDataDTO GetFormattedObject(UnionParseRequest request)
         {
+            switch (request.RiskStrategy)
+            {
+                case "tbpush":
+                    if (AlimamaPlus.IsDigitsOnly(request.Content))
+                    {
+                        request.Content = $"https://mobile.yangkeduo.com/goods.html?goods_id={request.Content}";
+                    }
+                    break;
+            }
+
             string shortLinkurl = GetLink(request.Content);
             string deeplink_url = GetDeeplink(shortLinkurl);
             var link_type = LinkTypeEnum.unknown;
@@ -130,6 +140,8 @@ namespace molilian.core
                 create_time = DateTime.Now,
                 end_point = _end_point,
                 parse_type = request.Type,
+                riskStrategy = request.RiskStrategy,
+                launchScene = request.LaunchScene,
             };
         }
 

Деякі файли не було показано, через те що забагато файлів було змінено