|
@ -46,6 +46,7 @@ namespace BBWY.Server.Business.Sync |
|
|
|
|
|
|
|
|
private void SyncProduct(ShopResponse shop, bool IsSyncAllProduct = false) |
|
|
private void SyncProduct(ShopResponse shop, bool IsSyncAllProduct = false) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var step = ""; |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var shopId = long.Parse(shop.ShopId); |
|
|
var shopId = long.Parse(shop.ShopId); |
|
@ -70,6 +71,7 @@ namespace BBWY.Server.Business.Sync |
|
|
AppToken = shop.AppToken, |
|
|
AppToken = shop.AppToken, |
|
|
Platform = shop.PlatformId |
|
|
Platform = shop.PlatformId |
|
|
}; |
|
|
}; |
|
|
|
|
|
step = $"PageIndex {request.PageIndex} "; |
|
|
while (true) |
|
|
while (true) |
|
|
{ |
|
|
{ |
|
|
var currentProductList = productBusiness.GetProductList(request); |
|
|
var currentProductList = productBusiness.GetProductList(request); |
|
@ -79,6 +81,7 @@ namespace BBWY.Server.Business.Sync |
|
|
|
|
|
|
|
|
foreach (var product in currentProductList.Items) |
|
|
foreach (var product in currentProductList.Items) |
|
|
{ |
|
|
{ |
|
|
|
|
|
step = $"PageIndex {request.PageIndex} ,Product {product.Id}"; |
|
|
var currentSkuList = productBusiness.GetProductSkuList(new SearchProductSkuRequest() |
|
|
var currentSkuList = productBusiness.GetProductSkuList(new SearchProductSkuRequest() |
|
|
{ |
|
|
{ |
|
|
AppKey = shop.AppKey, |
|
|
AppKey = shop.AppKey, |
|
@ -223,7 +226,7 @@ namespace BBWY.Server.Business.Sync |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
var shopData = JsonConvert.SerializeObject(shop); |
|
|
var shopData = JsonConvert.SerializeObject(shop); |
|
|
nLogManager.Default().Error(ex, $"SyncProduct ShopData:{shopData}"); |
|
|
nLogManager.Default().Error(ex, $"SyncProduct ShopData:{shopData},{step}"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -246,7 +249,7 @@ namespace BBWY.Server.Business.Sync |
|
|
public void SyncAllShopAllProduct() |
|
|
public void SyncAllShopAllProduct() |
|
|
{ |
|
|
{ |
|
|
var shopList = venderBusiness.GetShopList(platform: Enums.Platform.京东); |
|
|
var shopList = venderBusiness.GetShopList(platform: Enums.Platform.京东); |
|
|
//SyncProduct(shopList.FirstOrDefault(s => s.ShopId == "12309755"), true);
|
|
|
//SyncProduct(shopList.FirstOrDefault(s => s.ShopId == "11482739"), true);
|
|
|
foreach (var shop in shopList) |
|
|
foreach (var shop in shopList) |
|
|
{ |
|
|
{ |
|
|
Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); |
|
|
Task.Factory.StartNew(() => SyncProduct(shop, true), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.ProductSyncTaskScheduler); |
|
|