Browse Source

修复SKU解析问题

pjzs_starttask_update
shanji 1 year ago
parent
commit
634feb591b
  1. 2
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs
  2. 7
      BBWY.Server.Business/Sync/ProductSyncBusiness.cs

2
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -137,7 +137,7 @@ namespace BBWY.Server.Business
foreach (var attrValueAlias in attrValueAliasList) foreach (var attrValueAlias in attrValueAliasList)
{ {
if (attrValueAlias.Contains("{") && attrValueAlias.Contains("}")) if (attrValueAlias.Contains("{") && attrValueAlias.Contains("}") && attrValueAlias.Contains(":"))
{ {
titleBuilder.Append(string.Join(string.Empty, JArray.Parse(attrValueAlias).Select(j => $"{j.Value<string>("value")}{j.Value<string>("unit")}"))); titleBuilder.Append(string.Join(string.Empty, JArray.Parse(attrValueAlias).Select(j => $"{j.Value<string>("value")}{j.Value<string>("unit")}")));
} }

7
BBWY.Server.Business/Sync/ProductSyncBusiness.cs

@ -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);

Loading…
Cancel
Save