From 5d9302f1c12842fdd63d5c158b0cd713e40f0eb2 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Wed, 3 Jan 2024 00:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BB=8A=E6=97=A5GOI?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SiNan.Business/TodayGOIBusiness.cs | 130 ----------------------------- 1 file changed, 130 deletions(-) delete mode 100644 SiNan.Business/TodayGOIBusiness.cs diff --git a/SiNan.Business/TodayGOIBusiness.cs b/SiNan.Business/TodayGOIBusiness.cs deleted file mode 100644 index b94035c..0000000 --- a/SiNan.Business/TodayGOIBusiness.cs +++ /dev/null @@ -1,130 +0,0 @@ -using SiNan.Common.Log; -using SiNan.Common.Models; -using SiNan.Model.Db; -using SiNan.Model.Db.Mds; -using Yitter.IdGenerator; - -namespace SiNan.Business -{ - public class TodayGOIBusiness : BaseBusiness, IDenpendency - { - private RestApiService restApiService; - private string apihost = "http://yuding.qiyue666.com"; - - public TodayGOIBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, RestApiService restApiService) : base(fsql, nLogManager, idGenerator) - { - this.restApiService = restApiService; - } - - public IList GetJDCampaignList(Shops shop, int businessType, DateTime startTime, DateTime endTime) - { - var pageIndex = 1; - var shopId = long.Parse(shop.ShopId); - List campaignList = new List(); - while (true) - { - var httpResult = restApiService.SendRequest(apihost, "Api/PlatformSDK/GetJDSopularizeReportFormByCampaignLevel", new - { - shop.AppKey, - shop.AppSecret, - shop.AppToken, - EndDate = endTime, - StartDate = startTime, - Platform = shop.PlatformId, - PageIndex = pageIndex, - Business = businessType - }, null, HttpMethod.Post); - - if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) - throw new Exception($"获取JD推广报表-计划维度失败 {httpResult.Content}"); - - var res = JsonConvert.DeserializeObject>(httpResult.Content); - if (!res.Success) - throw new Exception($"获取JD推广报表-计划维度失败 {res.Msg}"); - - var jArray = res.Data; - if (jArray == null || jArray.Count == 0) - break; - - campaignList.AddRange(jArray.Select(j => new JDPopularizeCampaign() - { - Id = idGenerator.NewLong(), - BusinessType = businessType, - ShopId = shopId, - CreateTime = DateTime.Now, - CampaignId = j.Value("campaignId"), - CampaignName = j.Value("campaignName"), - Date = DateTime.ParseExact(j.Value("date"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), - Cost = j.Value("cost"), - Clicks = j.Value("clicks") ?? 0, - Impressions = j.Value("impressions") ?? 0, - TotalCartCnt = j.Value("totalCartCnt") ?? 0, - TotalOrderCnt = j.Value("totalOrderCnt") ?? 0 - })); - - if (jArray.Count() < 100) - break; - pageIndex++; - } - - return campaignList; - } - - public IList GetJDAdGroupList(Shops shop, DateTime startTime, DateTime endTime) - { - var pageIndex = 1; - var shopId = long.Parse(shop.ShopId); - List adGroupList = new List(); - while (true) - { - var httpResult = restApiService.SendRequest(apihost, "Api/PlatformSDK/GetJDSopularizeReportFormByAdGroupLevel", new - { - shop.AppKey, - shop.AppSecret, - shop.AppToken, - EndDate = endTime, - StartDate = startTime, - Platform = shop.PlatformId, - PageIndex = pageIndex, - Business = 2 - }, null, HttpMethod.Post); - - if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) - throw new Exception($"获取JD推广报表-单元维度失败 {httpResult.Content}"); - - var res = JsonConvert.DeserializeObject>(httpResult.Content); - if (!res.Success) - throw new Exception($"获取JD推广报表-单元维度失败 {res.Msg}"); - - var jArray = res.Data; - if (jArray == null || jArray.Count == 0) - break; - - adGroupList.AddRange(jArray.Select(j => new JDPopularizeAdGroup() - { - Id = idGenerator.NewLong(), - BusinessType = 2, - ShopId = shopId, - CreateTime = DateTime.Now, - CampaignId = j.Value("campaignId"), - AdGroupId = j.Value("adGroupId"), - 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 - })); - - if (jArray.Count() < 100) - break; - pageIndex++; - } - - return adGroupList; - } - - public IList<> - } -}