diff --git a/BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdGroupLevelSyncBusiness.cs b/BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdGroupLevelSyncBusiness.cs index 88b298a4..cc92b4e0 100644 --- a/BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdGroupLevelSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/JD/JDPopularizeReportFormAdGroupLevelSyncBusiness.cs @@ -46,7 +46,7 @@ namespace BBWY.Server.Business.Sync private void DeleteOldData(IList shops, DateTime startDate, DateTime endDate) { var shopIds = shops.Select(s => Convert.ToInt64(s.ShopId)).ToList(); - fsql.Delete().Where(s => shopIds.Contains(s.ShopId.Value) && + fsql.Delete().Where(s => shopIds.Contains(s.ShopId.Value) && s.Date >= startDate && s.Date <= endDate && s.BusinessType == 2).ExecuteAffrows(); } @@ -111,11 +111,11 @@ namespace BBWY.Server.Business.Sync Business = 2 }, null, HttpMethod.Post); if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) - throw new Exception($"获取JD推广报表-创意维度失败 {httpResult.Content}"); + throw new Exception($"获取JD推广报表-单元维度失败 {httpResult.Content}"); var presponse = JsonConvert.DeserializeObject>(httpResult.Content); if (!presponse.Success) - throw new Exception($"获取JD推广报表-创意维度失败 {presponse.Msg}"); + throw new Exception($"获取JD推广报表-单元维度失败 {presponse.Msg}"); SyncShopPopularizeReportFormAdGroupLevel(long.Parse(shop.ShopId), presponse.Data); currentCount = presponse.Data?.Count() ?? 0; @@ -131,15 +131,10 @@ namespace BBWY.Server.Business.Sync { if (jArray == null || !jArray.HasValues) return; - var insertList = new List(); + var insertList = new List(); foreach (var j in jArray) { - var adName = j.Value("adName"); - var skuMatch = Regex.Match(adName, @"^(.*-)?(\d+)-(.*)$"); - if (!skuMatch.Success) - continue; - var sku = skuMatch.Groups[2].Value; - insertList.Add(new JDPopularizeAdSku() + insertList.Add(new JDPopularizeAdGroup() { Id = idGenerator.NewLong(), BusinessType = 2, @@ -147,15 +142,13 @@ namespace BBWY.Server.Business.Sync CreateTime = DateTime.Now, CampaignId = j.Value("campaignId"), AdGroupId = j.Value("adGroupId"), - AdId = j.Value("adId"), - AdName = adName, + AdGroupName = j.Value("adGroupName"), Date = DateTime.ParseExact(j.Value("date"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), Cost = j["retrievalType0"].Value("cost"), Clicks = j["retrievalType0"].Value("clicks") ?? 0, Impressions = j["retrievalType0"].Value("impressions") ?? 0, TotalCartCnt = j["retrievalType0"].Value("totalCartCnt") ?? 0, - TotalOrderCnt = j["retrievalType0"].Value("totalOrderCnt") ?? 0, - Sku = sku + TotalOrderCnt = j["retrievalType0"].Value("totalOrderCnt") ?? 0 }); } if (insertList.Count > 0) diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs index ad799322..4bab30df 100644 --- a/BBWY.Test/Program.cs +++ b/BBWY.Test/Program.cs @@ -30,12 +30,12 @@ namespace BBWY.Test IJdClient client = GetJdClient(appkey, appSecret); var test1 = new JDBaoBiaoAPITest(); - //test1.Test1(client, token); + test1.Test(client, token); Console.WriteLine(); Console.WriteLine(); - test1.Test2(client, token); + //test1.Test2(client, token); Console.ReadKey(); }