From f97199aa96a7f76bcadd7270c3e3b872dab072f0 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Sun, 14 Aug 2022 04:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=A7=E5=93=81=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E6=98=BE=E7=A4=BA=E5=85=B7=E4=BD=93SKU?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sync/ProductSyncBusiness.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs index fafba1bd..270bcad2 100644 --- a/BBWY.Server.Business/Sync/ProductSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/ProductSyncBusiness.cs @@ -37,9 +37,9 @@ namespace BBWY.Server.Business.Sync this.productBusiness = productBusiness; } - private void SyncProduct(ShopResponse shop, ProductListResponse productList, out string productId) + private void SyncProduct(ShopResponse shop, ProductListResponse productList) { - productId = ""; + var currentProductId = ""; try { var shopId = long.Parse(shop.ShopId); @@ -55,7 +55,7 @@ namespace BBWY.Server.Business.Sync foreach (var product in productList.Items) { - productId = product.Id; + currentProductId = product.Id; var dbProduct = dbProducts.FirstOrDefault(dbp => dbp.Id == product.Id); if (dbProduct == null) { @@ -127,7 +127,7 @@ namespace BBWY.Server.Business.Sync } catch (Exception ex) { - throw new Exception(productId, ex); + throw new Exception(currentProductId, ex); } } @@ -149,7 +149,7 @@ namespace BBWY.Server.Business.Sync var productList = productBusiness.GetProductList(request); if (productList == null || productList.Count == 0) return; - SyncProduct(shop, productList, out string productId); + SyncProduct(shop, productList); if (productList.Items.Count < 50 || !IsSyncAllProduct) break; request.PageIndex++; @@ -181,11 +181,11 @@ namespace BBWY.Server.Business.Sync public void SyncAllShopAllProduct() { var shopList = venderBusiness.GetShopList(); - SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "瑞源玩具专营店"), true); //瑞源玩具专营店 - //foreach (var shop in shopList) - //{ - // Task.Factory.StartNew(() => SyncProduct(shop, true), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); - //} + //SyncProduct(shopList.FirstOrDefault(s => s.ShopName == "瑞源玩具专营店"), true); //瑞源玩具专营店 + foreach (var shop in shopList) + { + Task.Factory.StartNew(() => SyncProduct(shop, true), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); + } } } }