|
|
@ -46,7 +46,7 @@ namespace BBWY.Server.Business.Sync |
|
|
|
private void DeleteOldData(IList<ShopResponse> shops, DateTime startDate, DateTime endDate) |
|
|
|
{ |
|
|
|
var shopIds = shops.Select(s => Convert.ToInt64(s.ShopId)).ToList(); |
|
|
|
fsql.Delete<JDPopularizeAdSku>().Where(s => shopIds.Contains(s.ShopId.Value) && |
|
|
|
fsql.Delete<JDPopularizeAdGroup>().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<ApiResponse<JArray>>(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<JDPopularizeAdSku>(); |
|
|
|
var insertList = new List<JDPopularizeAdGroup>(); |
|
|
|
foreach (var j in jArray) |
|
|
|
{ |
|
|
|
var adName = j.Value<string>("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<long>("campaignId"), |
|
|
|
AdGroupId = j.Value<long>("adGroupId"), |
|
|
|
AdId = j.Value<long>("adId"), |
|
|
|
AdName = adName, |
|
|
|
AdGroupName = j.Value<string>("adGroupName"), |
|
|
|
Date = DateTime.ParseExact(j.Value<string>("date"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), |
|
|
|
Cost = j["retrievalType0"].Value<decimal>("cost"), |
|
|
|
Clicks = j["retrievalType0"].Value<int?>("clicks") ?? 0, |
|
|
|
Impressions = j["retrievalType0"].Value<int?>("impressions") ?? 0, |
|
|
|
TotalCartCnt = j["retrievalType0"].Value<int?>("totalCartCnt") ?? 0, |
|
|
|
TotalOrderCnt = j["retrievalType0"].Value<int?>("totalOrderCnt") ?? 0, |
|
|
|
Sku = sku |
|
|
|
TotalOrderCnt = j["retrievalType0"].Value<int?>("totalOrderCnt") ?? 0 |
|
|
|
}); |
|
|
|
} |
|
|
|
if (insertList.Count > 0) |
|
|
|