14 changed files with 205 additions and 21 deletions
@ -0,0 +1,12 @@ |
|||
{ |
|||
"version": 1, |
|||
"isRoot": true, |
|||
"tools": { |
|||
"dotnet-ef": { |
|||
"version": "7.0.12", |
|||
"commands": [ |
|||
"dotnet-ef" |
|||
] |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
using Microsoft.AspNetCore.Cors; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Primitives; |
|||
|
|||
namespace SiNan.API.Controllers |
|||
{ |
|||
[Produces("application/json")] |
|||
[Route("Api/[Controller]/[Action]")]
|
|||
[ApiController] |
|||
[EnableCors("cors")] |
|||
public class BaseApiController : ControllerBase |
|||
{ |
|||
protected IHttpContextAccessor httpContextAccessor; |
|||
public BaseApiController(IHttpContextAccessor httpContextAccessor) |
|||
{ |
|||
this.httpContextAccessor = httpContextAccessor; |
|||
} |
|||
|
|||
protected string GetUserId() |
|||
{ |
|||
return httpContextAccessor?.HttpContext?.User.Claims.Where(x => x.Type == "userId")?.FirstOrDefault()?.Value; |
|||
} |
|||
|
|||
protected string GetToken() |
|||
{ |
|||
httpContextAccessor.HttpContext.Request.Headers.TryGetValue("Authorization", out StringValues token); |
|||
return token; |
|||
} |
|||
|
|||
protected string GetClientCode() |
|||
{ |
|||
httpContextAccessor.HttpContext.Request.Headers.TryGetValue("ClientCode", out StringValues clientCode); |
|||
return clientCode; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SiNan.Business; |
|||
using SiNan.Model.Dto; |
|||
|
|||
namespace SiNan.API.Controllers |
|||
{ |
|||
public class GOIController : BaseApiController |
|||
{ |
|||
private GOIBusiness goiBusiness; |
|||
public GOIController(IHttpContextAccessor httpContextAccessor, GOIBusiness goiBusiness) : base(httpContextAccessor) |
|||
{ |
|||
this.goiBusiness = goiBusiness; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询产品综合GOI
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public ListResponse<ProductGOIResponse> QueryProductGOI([FromBody]QueryProductGOIRequest request) |
|||
{ |
|||
return goiBusiness.QueryProductGOI(request); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
namespace SiNan.Model.Dto |
|||
{ |
|||
public class QueryProductGOIRequest |
|||
{ |
|||
public string Spu { get; set; } |
|||
|
|||
public string Sku { get; set; } |
|||
|
|||
public string SpuTitle { get; set; } |
|||
|
|||
public Enums.Stage? Stage { get; set; } |
|||
|
|||
public DateTime StartDate { get; set; } |
|||
|
|||
public DateTime EndDate { get; set; } |
|||
|
|||
public int PageIndex { get; set; } |
|||
|
|||
public int PageSize { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
namespace SiNan.Model.Dto |
|||
{ |
|||
public class QueryProductSkuGOIRequest |
|||
{ |
|||
public string Spu { get; set; } |
|||
|
|||
public DateTime StartDate { get; set; } |
|||
|
|||
public DateTime EndDate { get; set; } |
|||
} |
|||
} |
@ -1,13 +0,0 @@ |
|||
namespace SiNan.Model.Dto.Request.Product |
|||
{ |
|||
public class SearchProductGOIRequestcs |
|||
{ |
|||
public string Spu { get; set; } |
|||
|
|||
public string Sku { get; set; } |
|||
|
|||
public string SpuTitle { get; set; } |
|||
|
|||
public Enums.Stage? Stage { get; set; } |
|||
} |
|||
} |
@ -1,12 +1,50 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace SiNan.Model.Dto.Response.GOI |
|||
namespace SiNan.Model.Dto |
|||
{ |
|||
internal class ProductSkuGOIResponse |
|||
public class ProductSkuGOIResponse : ProductSkuResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 商品维度 昨日GOI
|
|||
/// </summary>
|
|||
public GOIResponse ProductGOI_Yestoday { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品维度 近7天GOI
|
|||
/// </summary>
|
|||
public GOIResponse ProductGOI_Recent7Day { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品维度 近30天GOI
|
|||
/// </summary>
|
|||
public GOIResponse ProductGOI_Recent30Day { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 推广维度 昨日GOI
|
|||
/// </summary>
|
|||
public GOIResponse PromotionGOI_Yestoday { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 推广维度 近7天GOI
|
|||
/// </summary>
|
|||
public GOIResponse PromotionGOI_Recent7Day { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 推广维度 近30天GOI
|
|||
/// </summary>
|
|||
public GOIResponse PromotionGOI_Recent30Day { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 累计花费
|
|||
/// </summary>
|
|||
public decimal TotalCost { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 累计亏损
|
|||
/// </summary>
|
|||
public decimal TotalDeficit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最大亏损
|
|||
/// </summary>
|
|||
public decimal MaxDeficit { get; set; } |
|||
} |
|||
} |
|||
|
@ -0,0 +1,9 @@ |
|||
namespace SiNan.Model.Dto |
|||
{ |
|||
public class ListResponse<T> where T : class |
|||
{ |
|||
public List<T> ItemList { get; set; } |
|||
|
|||
public long Count { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
using SiNan.Model.Db; |
|||
|
|||
namespace SiNan.Model.Dto |
|||
{ |
|||
public class ProductSkuResponse : ProductSku |
|||
{ |
|||
} |
|||
} |
Loading…
Reference in new issue