Forráskód Böngészése

Thread.Sleep改await Task.Delay;增加隐藏账号不发送通知

dodo hold 1 éve
szülő
commit
049cea492c

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

@@ -73,7 +73,7 @@ namespace molilian.api.Controllers
             var uri = new Uri(proxy_server);
             string privateIp = uri.Host;
             AliyunCore core = new AliyunCore(account);
-            var success = core.ChangePublicIp(privateIp);
+            var success = await core.ChangePublicIpAsync(privateIp);
             return new APIResult(new { success = "ok" });
         }
 
@@ -96,7 +96,7 @@ namespace molilian.api.Controllers
             var uri = new Uri(proxy_server);
             string privateIp = uri.Host;
             AliyunCore core = new AliyunCore(account);
-            var success = core.ChangePublicIp(privateIp);
+            var success = await core.ChangePublicIpAsync(privateIp);
             return new APIResult(new { success = "ok" });
         }
 

+ 6 - 6
molilian.api/Controllers/public/TaskController.cs

@@ -167,7 +167,7 @@ namespace molilian.api.Controllers
                 try
                 {
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetSettleBills(sleep);
+                    total += await alimama.GetSettleBillsAsync(sleep);
                 }
                 catch (Exception ex)
                 {
@@ -207,7 +207,7 @@ namespace molilian.api.Controllers
 
 
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetHistoryOrders(sleep, startTime, endTime);
+                    total += await alimama.GetHistoryOrdersAsync(sleep, startTime, endTime);
                 }
                 catch (Exception ex)
                 {
@@ -238,7 +238,7 @@ namespace molilian.api.Controllers
                 try
                 {
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetIncyOrders(sleep);
+                    total += await alimama.GetIncyOrdersAsync(sleep);
                 }
                 catch (Exception ex)
                 {
@@ -272,7 +272,7 @@ namespace molilian.api.Controllers
                 try
                 {
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetOrdersByAdZone(adzoneId, startTime, endTime, sleep);
+                    total += await alimama.GetOrdersByAdZoneAsync(adzoneId, startTime, endTime, sleep);
                 }
                 catch (Exception ex)
                 {
@@ -312,7 +312,7 @@ namespace molilian.api.Controllers
 
 
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetHistoryRefundOrders(sleep, startTime, endTime);
+                    total += await alimama.GetHistoryRefundOrdersAsync(sleep, startTime, endTime);
                 }
                 catch (Exception ex)
                 {
@@ -346,7 +346,7 @@ namespace molilian.api.Controllers
                 try
                 {
                     var alimama = new AlimamaPlus(account);
-                    total += alimama.GetIncyRefundOrders(sleep);
+                    total += await alimama.GetIncyRefundOrdersAsync(sleep);
                 }
                 catch (Exception ex)
                 {

+ 2 - 2
molilian.api/Controllers/public/TestController.cs

@@ -71,7 +71,7 @@ namespace molilian.api.Controllers
             var uri = new Uri(proxy_server);
             string privateIp = uri.Host;
             AliyunCore core = new AliyunCore(account);
-            var success = core.ChangePublicIp(privateIp);
+            var success = await core.ChangePublicIpAsync(privateIp);
             return new APIResult(new { success = "ok" });
         }
 
@@ -94,7 +94,7 @@ namespace molilian.api.Controllers
             var uri = new Uri(proxy_server);
             string privateIp = uri.Host;
             AliyunCore core = new AliyunCore(account);
-            var success = core.ChangePublicIp(privateIp);
+            var success = await core.ChangePublicIpAsync(privateIp);
             return new APIResult(new { success = "ok" });
         }
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 2 - 2
molilian.core/Core/aliyun/AliyunCore.cs

@@ -165,7 +165,7 @@ namespace molilian.core
 
 
 
-        public (bool, string, string) ChangePublicIp(string privateIp)
+        public async Task<(bool, string, string)> ChangePublicIpAsync(string privateIp)
         {
             try
             {
@@ -242,7 +242,7 @@ namespace molilian.core
                             var currentPrivateIpAddress = currentPrivateIpSet.Where(e => e.PrivateIpAddress.Equals(privateIp)).FirstOrDefault();
                             unPublicIpAddress = currentPrivateIpAddress?.AssociatedPublicIp?.PublicIpAddress;
                             if (string.IsNullOrEmpty(unPublicIpAddress)) break;
-                            Thread.Sleep(500);
+                            await Task.Delay(500);
                         }
 
                         //第5步、绑定新的公网ip

+ 2 - 1
molilian.core/Core/jd/JdPoolCore.cs

@@ -270,7 +270,7 @@ namespace molilian.core
             _all_cached = null;
             _cached = null;
             _ = ListAsync(true);
-            _ = AllListAsync();
+            _ = AllListAsync(true);
         }
 
         public static int Update(JdPoolDTO account)
@@ -370,6 +370,7 @@ namespace molilian.core
                 update.Where("name=@name", new { name }).Update();
             }
             _ = ListAsync(true);
+            _ = AllListAsync(true);
             NotifyCore.Notify(new NifyMessage
             {
                 message = $"【京东联盟{accountId}:{name}】cookie 掉线\n\n{content}",

+ 6 - 2
molilian.core/Core/log/jd.cs

@@ -133,7 +133,7 @@ namespace molilian.core
             return total;
         }
 
-        public static async Task ParseLogAsync(JdDataDTO response)
+        public static async Task ParseLogAsync(JdDataDTO response, bool is_hide)
         {
             try
             {
@@ -195,7 +195,11 @@ namespace molilian.core
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            _ = NotifyCore.QYWeixinPushNotifyAsync(response.reason, message);
+
+                            if (!is_hide)
+                            {
+                                _ = NotifyCore.QYWeixinPushNotifyAsync(response.reason, message);
+                            }
                         }
                     }
                 }

+ 7 - 6
molilian.core/Core/pdd/PddPoolCore.cs

@@ -28,7 +28,7 @@ namespace molilian.core
         private static string _end_point;
         private static Dictionary<string, decimal> _incomeAmt = new();
         private static ConcurrentDictionary<int, DateTime> _suspend = new();
-        
+
         // 添加本地内存统计 - 线程安全
         private static readonly ConcurrentDictionary<string, int> _dailyUsage = new();
         private static volatile string _currentDay = DateTime.Now.ToString("yyyyMMdd");
@@ -74,10 +74,10 @@ namespace molilian.core
         private static void CheckAndResetDailyStats()
         {
             var today = DateTime.Now.ToString("yyyyMMdd");
-            
+
             // 使用volatile读取,如果日期相同则直接返回,避免锁开销
             if (today == _currentDay) return;
-            
+
             // 只有在日期不同时才尝试获取锁
             lock (_dayResetLock)
             {
@@ -86,10 +86,10 @@ namespace molilian.core
                 {
                     // 清空所有统计数据
                     _dailyUsage.Clear();
-                    
+
                     // 原子性更新当前日期(volatile写入)
                     _currentDay = today;
-                    
+
                     // 可选:记录日期切换日志
                     Console.WriteLine($"Daily stats reset for date: {today}");
                 }
@@ -102,7 +102,7 @@ namespace molilian.core
             CheckAndResetDailyStats();
             string currentDay = _currentDay; // 获取当前快照,确保一致性
             string key = $"{accountId}_{currentDay}";
-            
+
             // 使用AddOrUpdate确保原子性递增
             _dailyUsage.AddOrUpdate(key, 1, (k, oldValue) => oldValue + 1);
         }
@@ -243,6 +243,7 @@ namespace molilian.core
             _cached = null;
             _all_cached = null;
             _ = List(true);
+            _ = AllListAsync(true);
         }
 
         public static void Disabled(string name)

+ 3 - 2
molilian.core/Core/taoke/TkPoolCore.cs

@@ -313,8 +313,8 @@ namespace molilian.core
 
         public static void Refresh()
         {
-            _ = AllListAsync(true);
             _ = ListAsync(true);
+            _ = AllListAsync(true);
             TkEndpointCore.Refresh();
             TkEndpointManager.Refresh();
         }
@@ -351,7 +351,7 @@ namespace molilian.core
                 priority = NifyMessagePriority.high,
                 tags = ["red_circle"]
             });
-            _ = NotifyCore.QYWeixinPushNotifyAsync("暂停", $"【淘客{accountId}:{name}】{endpoint} 暂停");
+
             _ = EndPointCore.NotifyReload(true);
         }
 
@@ -376,6 +376,7 @@ namespace molilian.core
             }
 
             _ = ListAsync(true);
+            _ = AllListAsync(true);
 
             NotifyCore.Notify(new NifyMessage
             {

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

@@ -518,6 +518,7 @@ namespace molilian.core
             result.riskStrategy = riskStrategy;
             result.launchScene = launchScene;
             bool IfExceptional = false;
+            bool is_hide = false;
             try
             {
 
@@ -539,7 +540,7 @@ namespace molilian.core
                         result.deeplink_url = string.Empty;
                         result.message = "放弃转链";
                         result.reason = "规则排除";
-                        _ = TkLogCore.ParseLogAsync(result);
+                        _ = TkLogCore.ParseLogAsync(result, is_hide);
                         return JdParseOutput(result);
                     }
                 }
@@ -580,7 +581,7 @@ namespace molilian.core
                     result.success = false;
                     result.message = "放弃转链";
                     result.reason = reason;
-                    _ = TkLogCore.ParseLogAsync(result);
+                    _ = TkLogCore.ParseLogAsync(result, is_hide);
                     return JdParseOutput(result);
                 }
 
@@ -615,11 +616,12 @@ namespace molilian.core
                         _ => JdUnionPlus.GetDefaultStyleDeeplink(result.shortLinkurl),
                     };
 
-                    _ = TkLogCore.ParseLogAsync(result);
+                    _ = TkLogCore.ParseLogAsync(result, is_hide);
                     return JdParseOutput(result);
                 }
                 result.accountId = account.id;
                 result.accountName = account.name;
+                is_hide = account.is_hide;
 
                 var plus = new JdUnionPlus(account);
 
@@ -658,7 +660,7 @@ namespace molilian.core
                 };
             }
 
-            _ = TkLogCore.ParseLogAsync(result);
+            _ = TkLogCore.ParseLogAsync(result, is_hide);
             return JdParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
 
         }

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

@@ -489,7 +489,7 @@ namespace molilian.core
                     result.content = content;
                     result.deeplink_url = string.Empty;
 
-                    _ = TkLogCore.ParseLogAsync(result);
+                    _ = TkLogCore.ParseLogAsync(result, false);
                     return JdParseOutput(result);
                 }
 
@@ -514,7 +514,7 @@ namespace molilian.core
                         result.deeplink_url = string.Empty;
                         result.message = "放弃转链";
                         result.reason = "规则排除";
-                        _ = TkLogCore.ParseLogAsync(result);
+                        _ = TkLogCore.ParseLogAsync(result, false);
                         return JdParseOutput(result);
                     }
                 }
@@ -544,7 +544,7 @@ namespace molilian.core
                     {
                         result.deeplink_url = string.Empty;
                     }
-                    _ = TkLogCore.ParseLogAsync(result);
+                    _ = TkLogCore.ParseLogAsync(result, false);
                     return JdParseOutput(result);
                 }
 
@@ -572,7 +572,7 @@ namespace molilian.core
                     {
                         result.deeplink_url = string.Empty;
                     }
-                    _ = TkLogCore.ParseLogAsync(result);
+                    _ = TkLogCore.ParseLogAsync(result, false);
                     return JdParseOutput(result);
                 }
                 result.accountId = account.id;
@@ -619,7 +619,7 @@ namespace molilian.core
             {
                 result.deeplink_url = string.Empty;
             }
-            _ = TkLogCore.ParseLogAsync(result);
+            _ = TkLogCore.ParseLogAsync(result, false);
             return JdParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
 
         }

+ 8 - 8
molilian.core/Plus/Alimama/RefundOrders.cs

@@ -7,7 +7,7 @@ namespace molilian.core
     {
         private const string base_refund_orders_url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/report.publisher.getRefundOrderDetail.json";
 
-        public int GetHistoryRefundOrders(int sleep, DateTime startTime, DateTime endTime)
+        public async Task<int> GetHistoryRefundOrdersAsync(int sleep, DateTime startTime, DateTime endTime)
         {
 
             //DateTime endTime = DateTime.Now;
@@ -31,7 +31,7 @@ namespace molilian.core
 
             //#else
             //当日往前查询
-            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkRefundOrders(startTime, endTime, DateTime.MinValue, false, sleep);
+            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = await GetTkRefundOrdersAsync(startTime, endTime, DateTime.MinValue, false, sleep);
 
             //#endif       
 
@@ -132,7 +132,7 @@ namespace molilian.core
 
             return total;
         }
-        public int GetIncyRefundOrders(int sleep)
+        public async Task<int> GetIncyRefundOrdersAsync(int sleep)
         {
             string cacheKey = $":cache:GetIncyRefundOrders:{_accountId}";
             DateTime endTime = DateTime.Now;
@@ -156,7 +156,7 @@ namespace molilian.core
             }
 
             //当日往前查询
-            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkRefundOrders(startTime, endTime, last_modifiedTime, true, sleep);
+            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = await GetTkRefundOrdersAsync(startTime, endTime, last_modifiedTime, true, sleep);
             if (max_modifiedTime != DateTime.MinValue)
             {
                 RedisHelper.Set(cacheKey, max_modifiedTime);
@@ -247,7 +247,7 @@ namespace molilian.core
             return total;
         }
 
-        public (int, DateTime, List<DateTime>) GetTkRefundOrders(DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
+        public async Task<(int, DateTime, List<DateTime>)> GetTkRefundOrdersAsync(DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
         {
             List<DateTime> orderTimes = [];
 
@@ -312,7 +312,7 @@ namespace molilian.core
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            Thread.Sleep(i * 60 * 1000);
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
 
@@ -325,7 +325,7 @@ namespace molilian.core
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            Thread.Sleep(i * 60 * 1000);
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
                         break;
@@ -412,7 +412,7 @@ namespace molilian.core
                 hasNext = data.Read<bool>("hasNext");
                 positionIndex = data.Read<string>("positionIndex");
 
-                if (sleep > 0) Thread.Sleep(sleep);
+                if (sleep > 0) await Task.Delay(sleep);
             }
             return (total, max_modifiedTime, orderTimes);
         }

+ 2 - 2
molilian.core/Plus/Alimama/bills.cs

@@ -6,7 +6,7 @@ namespace molilian.core
     public partial class AlimamaPlus
     {
         private const string base_bill_url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/new.settle.media.pre.income.daily.bill.detail.json";
-        public int GetSettleBills(int sleep)
+        public async Task<int> GetSettleBillsAsync(int sleep)
         {
             DateTime startTime = DateTime.Parse("2024-03-01");
             DateTime endTime = DateTime.Now;
@@ -103,7 +103,7 @@ namespace molilian.core
                 hasNext = data.Read<bool>("hasNext");
                 dataVersion = data.Read<string>("dataVersion");
 
-                if (sleep > 0) Thread.Sleep(sleep);
+                if (sleep > 0) await Task.Delay(sleep);
             }
             return total;
         }

+ 25 - 17
molilian.core/Plus/Alimama/orders.cs

@@ -7,7 +7,7 @@ namespace molilian.core
     {
         private const string base_orders_url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/report.getTbkOrderDetails.json";
 
-        public int GetHistoryOrders(int sleep, DateTime startTime, DateTime endTime)
+        public async Task<int> GetHistoryOrdersAsync(int sleep, DateTime startTime, DateTime endTime)
         {
             //DateTime endTime = DateTime.Now;
             //DateTime startTime = endTime.AddDays(-90);
@@ -33,7 +33,7 @@ namespace molilian.core
             //#endif       
 
             //当日往前查询
-            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkOrders(startTime, endTime, DateTime.MinValue, false, sleep);
+            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = await GetTkOrdersAsync(startTime, endTime, DateTime.MinValue, false, sleep);
 
             if (_account.is_hide) return total;
 
@@ -105,7 +105,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
             return total;
 
         }
-        public int GetIncyOrders(int sleep)
+        public async Task<int> GetIncyOrdersAsync(int sleep)
         {
             string cacheKey = $":cache:GetIncyOrders:{_accountName}";
             string cacheKey2 = $":cache:GetIncyOrders:{_accountId}";
@@ -130,7 +130,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
             }
 
             //当日往前查询
-            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkOrders(startTime, endTime, last_modifiedTime, true, sleep);
+            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = await GetTkOrdersAsync(startTime, endTime, last_modifiedTime, true, sleep);
             if (max_modifiedTime != DateTime.MinValue)
             {
                 RedisHelper.Set(cacheKey, max_modifiedTime);
@@ -208,7 +208,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
             return total;
         }
 
-        public int GetOrdersByAdZone(long adzoneId, DateTime startTime, DateTime endTime, int sleep)
+        public async Task<int> GetOrdersByAdZoneAsync(long adzoneId, DateTime startTime, DateTime endTime, int sleep)
         {
             string cacheKey = $":cache:GetOrdersByAdZone:{_accountName}";
             string cacheKey2 = $":cache:GetOrdersByAdZone:{_accountId}";
@@ -225,7 +225,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
             }
 
             //当日往前查询
-            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkOrdersByAdZone(adzoneId, startTime, endTime, last_modifiedTime, true, sleep);
+            (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = await GetTkOrdersByAdZoneAsync(adzoneId, startTime, endTime, last_modifiedTime, true, sleep);
             if (max_modifiedTime != DateTime.MinValue)
             {
                 RedisHelper.Set(cacheKey, max_modifiedTime);
@@ -234,7 +234,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
 
             return total;
         }
-        public (int, DateTime, List<DateTime>) GetTkOrdersByAdZone(long adzoneId, DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
+        public async Task<(int, DateTime, List<DateTime>)> GetTkOrdersByAdZoneAsync(long adzoneId, DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
         {
             List<DateTime> orderTimes = [];
 
@@ -303,7 +303,12 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            Thread.Sleep(i * 60 * 1000);
+                            if (!_account.is_hide)
+                            {
+                                _ = NotifyCore.QYWeixinPushNotifyAsync("GetTkOrders【出现滑动验证码】", message);
+                            }
+
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
 
@@ -316,7 +321,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            Thread.Sleep(i * 60 * 1000);
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
                         break;
@@ -383,13 +388,13 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                 hasNext = data.Read<bool>("hasNext");
                 positionIndex = data.Read<string>("positionIndex");
 
-                if (sleep > 0) Thread.Sleep(sleep);
+                if (sleep > 0) await Task.Delay(sleep);
             }
             return (total, max_modifiedTime, orderTimes);
         }
 
 
-        public (int, DateTime, List<DateTime>) GetTkOrders(DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
+        public async Task<(int, DateTime, List<DateTime>)> GetTkOrdersAsync(DateTime startTime, DateTime endTime, DateTime last_modifiedTime, bool desc = true, int sleep = 100)
         {
             List<DateTime> orderTimes = [];
 
@@ -482,8 +487,11 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            _ = NotifyCore.QYWeixinPushNotifyAsync("GetTkOrders【出现滑动验证码】", message);
-                            Thread.Sleep(i * 60 * 1000);
+                            if (!_account.is_hide)
+                            {
+                                _ = NotifyCore.QYWeixinPushNotifyAsync("GetTkOrders【出现滑动验证码】", message);
+                            }
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
 
@@ -498,7 +506,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                                 priority = NifyMessagePriority.high,
                                 tags = ["red_circle"]
                             });
-                            Thread.Sleep(i * 60 * 1000);
+                            await Task.Delay(i * 60 * 1000);
                             continue;
                         }
                         break;
@@ -538,7 +546,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                     string message = $"【GetRawItemId】{_accountId}:{_accountName}\t{_proxy?.Address}\n" +
                         $"{body}\n{ex.Message}\n{ex.StackTrace}";
 
-                    if (sleep > 0) Thread.Sleep(sleep);
+                    if (sleep > 0) await Task.Delay(sleep);
                     throw new APIException(body);
                 }
                 try
@@ -574,14 +582,14 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                 }
                 catch (Exception ex)
                 {
-                    if (sleep > 0) Thread.Sleep(sleep);
+                    if (sleep > 0) await Task.Delay(sleep);
                     throw;
                 }
                 pageNo++;
                 hasNext = data.Read<bool>("hasNext");
                 positionIndex = data.Read<string>("positionIndex");
 
-                if (sleep > 0) Thread.Sleep(sleep);
+                if (sleep > 0) await Task.Delay(sleep);
             }
             return (total, max_modifiedTime, orderTimes);
         }

+ 1 - 2
molilian.core/Plus/Alimama/parse_2.cs

@@ -23,8 +23,7 @@ namespace molilian.core
             try
             {
                 WebClientUtility client = new WebClientUtility();
-                Thread.Sleep(5000);
-                //await Task.Delay(5000, token); // 使用Task.Delay代替Thread.Sleep
+                await Task.Delay(5000);
                 client.Timeout = TimeSpan.FromMilliseconds(3000);
                 var response = await client.RequestAsync(url);
                 var body = response.Body();

+ 1 - 1
molilian.core/Plus/JDUnion/order.cs

@@ -361,7 +361,7 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                 }
                 pageNo++;
                 hasNext = data.Read<bool>("hasNext");
-                if (sleep > 0) Thread.Sleep(sleep);
+                if (sleep > 0) await Task.Delay(sleep);
             }
             return (total, max_modifiedTime, orderTimes);
         }

+ 1 - 1
molilian.core/Plus/TaobaoOpen/TaobaoOpenPlus.cs

@@ -115,7 +115,7 @@ namespace molilian.core
                         throw;
                     }
                     retryCount++;
-                    Thread.Sleep(100);
+                    await Task.Delay(100);
                 }
             }
 

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott