diff --git a/SiNan.API/Controllers/GOIController.cs b/SiNan.API/Controllers/GOIController.cs index c98ed7d..728c380 100644 --- a/SiNan.API/Controllers/GOIController.cs +++ b/SiNan.API/Controllers/GOIController.cs @@ -36,6 +36,28 @@ namespace SiNan.API.Controllers return goiBusiness.QueryProductSkuGOI(request); } + /// + /// 产品维度分析-SPU花费曲线接口 + /// + /// + /// + [HttpPost] + public List PopularizeCostCurveStatisticsBySpu([FromBody] PopularizeCostCurveStatisticsBySpuRequest request) + { + return goiBusiness.PopularizeCostCurveStatisticsBySpu(request); + } + + /// + /// 产品维度分析-SKU花费曲线接口 + /// + /// + /// + [HttpPost] + public List PopularizeCostCurveStatisticsBySku([FromBody] PopularizeCostCurveStatisticsBySkuRequest request) + { + return goiBusiness.PopularizeCostCurveStatisticsBySku(request); + } + /// /// 产品360推广分析 /// @@ -69,6 +91,7 @@ namespace SiNan.API.Controllers return goiBusiness.QueryProduct360TopStatistics(request); } + /// /// 根据spu查询推广维度GOI /// diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs index 7e47447..6b5ae62 100644 --- a/SiNan.Business/GOIBusiness.cs +++ b/SiNan.Business/GOIBusiness.cs @@ -700,6 +700,44 @@ namespace SiNan.Business }; } + public List PopularizeCostCurveStatisticsBySpu(PopularizeCostCurveStatisticsBySpuRequest request) + { + if (string.IsNullOrEmpty(request.Spu)) + throw new BusinessException("缺少spu"); + if (request.StartDate == null) + request.StartDate = DateTime.Now.Date.AddDays(-30); + if (request.EndDate == null) + request.EndDate = DateTime.Now.Date.AddDays(-1); + return fsql.Select().Where(a => a.ShopId == request.ShopId && + a.ProductId == request.Spu && + a.Date >= request.StartDate && + a.Date <= request.EndDate) + .ToList(a => new PopularizeCostCurveStatisticsResponse() + { + Cost = a.Cost, + Date = a.Date.Value + }); + } + + public List PopularizeCostCurveStatisticsBySku(PopularizeCostCurveStatisticsBySkuRequest request) + { + if (string.IsNullOrEmpty(request.Sku)) + throw new BusinessException("缺少sku"); + if (request.StartDate == null) + request.StartDate = DateTime.Now.Date.AddDays(-30); + if (request.EndDate == null) + request.EndDate = DateTime.Now.Date.AddDays(-1); + return fsql.Select().Where(a => a.ShopId == request.ShopId && + a.ProductId == request.Sku && + a.Date >= request.StartDate && + a.Date <= request.EndDate) + .ToList(a => new PopularizeCostCurveStatisticsResponse() + { + Cost = a.Cost, + Date = a.Date.Value + }); + } + public ListResponse QueryPopularizeLevelGOIBySpuId(QueryPopularizeLevelGOIBySpuIdRequest request) { var list = new List(); diff --git a/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySkuRequest.cs b/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySkuRequest.cs new file mode 100644 index 0000000..b153a71 --- /dev/null +++ b/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySkuRequest.cs @@ -0,0 +1,19 @@ +namespace SiNan.Model.Dto +{ + public class PopularizeCostCurveStatisticsBySkuRequest + { + public long ShopId { get; set; } + + public string Sku { get; set; } + + /// + /// 曲线图起点时间,为空默认最近30天 + /// + public DateTime? StartDate { get; set; } + + /// + /// 曲线图结束时间,为空默认昨天 + /// + public DateTime? EndDate { get; set; } + } +} diff --git a/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySpuRequest.cs b/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySpuRequest.cs new file mode 100644 index 0000000..1df4a60 --- /dev/null +++ b/SiNan.Model/Dto/Request/Statistics/PopularizeCostCurveStatisticsBySpuRequest.cs @@ -0,0 +1,19 @@ +namespace SiNan.Model.Dto +{ + public class PopularizeCostCurveStatisticsBySpuRequest + { + public long ShopId { get; set; } + + public string Spu { get; set; } + + /// + /// 曲线图起点时间,为空默认最近30天 + /// + public DateTime? StartDate { get; set; } + + /// + /// 曲线图结束时间,为空默认昨天 + /// + public DateTime? EndDate { get; set; } + } +} diff --git a/SiNan.Model/Dto/Response/Statistics/PopularizeCostCurveStatisticsResponse.cs b/SiNan.Model/Dto/Response/Statistics/PopularizeCostCurveStatisticsResponse.cs new file mode 100644 index 0000000..26ab030 --- /dev/null +++ b/SiNan.Model/Dto/Response/Statistics/PopularizeCostCurveStatisticsResponse.cs @@ -0,0 +1,9 @@ +namespace SiNan.Model.Dto +{ + public class PopularizeCostCurveStatisticsResponse + { + public decimal? Cost { get; set; } + + public DateTime Date { get; set; } + } +}