shanji 3 years ago
parent
commit
0a28196ba9
  1. 15
      BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdLevelSyncBusiness.cs

15
BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdLevelSyncBusiness.cs

@ -117,7 +117,7 @@ namespace BBWY.Server.Business.Sync
if (!presponse.Success)
throw new Exception($"获取JD推广报表-创意维度失败 {presponse.Msg}");
SyncShopPopularizeReportFormAdLevel(long.Parse(shop.ShopId), presponse.Data);
SyncShopPopularizeReportFormAdLevel(shop.ShopName, long.Parse(shop.ShopId), presponse.Data);
currentCount = presponse.Data?.Count() ?? 0;
}
catch (Exception ex)
@ -127,7 +127,7 @@ namespace BBWY.Server.Business.Sync
}
}
private void SyncShopPopularizeReportFormAdLevel(long shopId, JArray jArray)
private void SyncShopPopularizeReportFormAdLevel(string shopName, long shopId, JArray jArray)
{
if (jArray == null || !jArray.HasValues)
return;
@ -135,6 +135,7 @@ namespace BBWY.Server.Business.Sync
foreach (var j in jArray)
{
var adName = j.Value<string>("adName");
var adId = j.Value<string>("adId");
var skuMatch = Regex.Match(adName, @"^(.*-)?(\d+)-(.*)$");
string sku;
@ -144,12 +145,18 @@ namespace BBWY.Server.Business.Sync
{
skuMatch = Regex.Match(adName, @"^(.*)-(\d+)$");
if (!skuMatch.Success)
{
nLogManager.GetLogger($"创意维度-{shopName}").Info($"创意名称识别失败 adId {adId} adName {adName} 名称格式错误");
continue;
}
sku = skuMatch.Groups[2].Value;
}
if (sku == j.Value<string>("adId"))
if (sku == adId)
{
nLogManager.GetLogger($"创意维度-{shopName}").Info($"创意名称识别失败 adId {adId} adName {adName} 提取的[sku]与创意Id相同");
continue;
}
insertList.Add(new JDPopularizeAdSku()
{
@ -159,7 +166,7 @@ namespace BBWY.Server.Business.Sync
CreateTime = DateTime.Now,
CampaignId = j.Value<long>("campaignId"),
AdGroupId = j.Value<long>("adGroupId"),
AdId = j.Value<long>("adId"),
AdId = long.Parse(adId),
AdName = adName,
Date = DateTime.ParseExact(j.Value<string>("date"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture),
Cost = j["retrievalType0"].Value<decimal>("cost"),

Loading…
Cancel
Save