diff --git a/SiNan.API/.config/dotnet-tools.json b/SiNan.API/.config/dotnet-tools.json
new file mode 100644
index 0000000..2f789b0
--- /dev/null
+++ b/SiNan.API/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-ef": {
+ "version": "7.0.12",
+ "commands": [
+ "dotnet-ef"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/SiNan.API/Controllers/BaseApiController.cs b/SiNan.API/Controllers/BaseApiController.cs
new file mode 100644
index 0000000..72d1f41
--- /dev/null
+++ b/SiNan.API/Controllers/BaseApiController.cs
@@ -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;
+ }
+ }
+}
diff --git a/SiNan.API/Controllers/GOIController.cs b/SiNan.API/Controllers/GOIController.cs
new file mode 100644
index 0000000..81726dd
--- /dev/null
+++ b/SiNan.API/Controllers/GOIController.cs
@@ -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;
+ }
+
+ ///
+ /// 查询产品综合GOI
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ListResponse QueryProductGOI([FromBody]QueryProductGOIRequest request)
+ {
+ return goiBusiness.QueryProductGOI(request);
+ }
+ }
+}
diff --git a/SiNan.API/Program.cs b/SiNan.API/Program.cs
index 3b27e59..6afca3a 100644
--- a/SiNan.API/Program.cs
+++ b/SiNan.API/Program.cs
@@ -128,6 +128,13 @@ services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(
var app = builder.Build();
+app.UseSwagger(c => c.SerializeAsV2 = true)
+ .UseSwaggerUI(c =>
+ {
+ c.SwaggerEndpoint("/swagger/v1/swagger.json", "SiNan API");
+ c.RoutePrefix = string.Empty;
+ });
+
app.UseMiddleware();
app.UseRouting();
app.UseCors("cors");
diff --git a/SiNan.API/appsettings.json b/SiNan.API/appsettings.json
index 51c585f..bda8420 100644
--- a/SiNan.API/appsettings.json
+++ b/SiNan.API/appsettings.json
@@ -6,6 +6,7 @@
}
},
"AllowedHosts": "*",
+ "Secret": "D96BFA5B-F2AF-45BC-9342-5A55C3F9BBB0",
"ConnectionStrings": {
//"DB": "data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=bbwy;charset=utf8;sslmode=none;"
"BBWYCDB": "data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=bbwy_test;charset=utf8;sslmode=none;",
diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs
index 6e94e82..36c9e90 100644
--- a/SiNan.Business/GOIBusiness.cs
+++ b/SiNan.Business/GOIBusiness.cs
@@ -1,5 +1,6 @@
using SiNan.Common.Log;
using SiNan.Common.Models;
+using SiNan.Model.Dto;
using Yitter.IdGenerator;
namespace SiNan.Business
@@ -12,5 +13,9 @@ namespace SiNan.Business
this.freeSqlMultiDBManager = freeSqlMultiDBManager;
}
+ public ListResponse QueryProductGOI(QueryProductGOIRequest request)
+ {
+ return new ListResponse();
+ }
}
}
diff --git a/SiNan.Model/Dto/Request/Product/QueryProductGOIRequest.cs b/SiNan.Model/Dto/Request/Product/QueryProductGOIRequest.cs
new file mode 100644
index 0000000..baa6244
--- /dev/null
+++ b/SiNan.Model/Dto/Request/Product/QueryProductGOIRequest.cs
@@ -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; }
+ }
+
+}
\ No newline at end of file
diff --git a/SiNan.Model/Dto/Request/Product/QueryProductSkuGOIRequest.cs b/SiNan.Model/Dto/Request/Product/QueryProductSkuGOIRequest.cs
new file mode 100644
index 0000000..df86995
--- /dev/null
+++ b/SiNan.Model/Dto/Request/Product/QueryProductSkuGOIRequest.cs
@@ -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; }
+ }
+}
diff --git a/SiNan.Model/Dto/Request/Product/SearchProductGOIRequestcs.cs b/SiNan.Model/Dto/Request/Product/SearchProductGOIRequestcs.cs
deleted file mode 100644
index a5836bd..0000000
--- a/SiNan.Model/Dto/Request/Product/SearchProductGOIRequestcs.cs
+++ /dev/null
@@ -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; }
- }
-}
\ No newline at end of file
diff --git a/SiNan.Model/Dto/Response/GOI/GOIResponse.cs b/SiNan.Model/Dto/Response/GOI/GOIResponse.cs
index 6dec949..3ad64c8 100644
--- a/SiNan.Model/Dto/Response/GOI/GOIResponse.cs
+++ b/SiNan.Model/Dto/Response/GOI/GOIResponse.cs
@@ -1,11 +1,23 @@
namespace SiNan.Model.Dto
{
+ ///
+ /// GOI对象
+ ///
public class GOIResponse
{
+ ///
+ /// 花费
+ ///
public decimal Cost { get; set; }
+ ///
+ /// 利润
+ ///
public decimal Profit { get; set; }
+ ///
+ /// GOI
+ ///
public decimal GOI
{
get
diff --git a/SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs b/SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs
index 25e6a41..ae2f508 100644
--- a/SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs
+++ b/SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs
@@ -46,5 +46,12 @@
/// 最大亏损
///
public decimal MaxDeficit { get; set; }
+
+ ///
+ /// SKU GOI
+ ///
+ public List ProductSkuGOIList { get; set; }
+
+
}
}
diff --git a/SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs b/SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs
index 1a4a997..b47cb5a 100644
--- a/SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs
+++ b/SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs
@@ -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
{
+ ///
+ /// 商品维度 昨日GOI
+ ///
+ public GOIResponse ProductGOI_Yestoday { get; set; }
+
+ ///
+ /// 商品维度 近7天GOI
+ ///
+ public GOIResponse ProductGOI_Recent7Day { get; set; }
+
+ ///
+ /// 商品维度 近30天GOI
+ ///
+ public GOIResponse ProductGOI_Recent30Day { get; set; }
+
+ ///
+ /// 推广维度 昨日GOI
+ ///
+ public GOIResponse PromotionGOI_Yestoday { get; set; }
+
+ ///
+ /// 推广维度 近7天GOI
+ ///
+ public GOIResponse PromotionGOI_Recent7Day { get; set; }
+
+ ///
+ /// 推广维度 近30天GOI
+ ///
+ public GOIResponse PromotionGOI_Recent30Day { get; set; }
+
+ ///
+ /// 累计花费
+ ///
+ public decimal TotalCost { get; set; }
+
+ ///
+ /// 累计亏损
+ ///
+ public decimal TotalDeficit { get; set; }
+
+ ///
+ /// 最大亏损
+ ///
+ public decimal MaxDeficit { get; set; }
}
}
diff --git a/SiNan.Model/Dto/Response/ListResponse.cs b/SiNan.Model/Dto/Response/ListResponse.cs
new file mode 100644
index 0000000..d46387e
--- /dev/null
+++ b/SiNan.Model/Dto/Response/ListResponse.cs
@@ -0,0 +1,9 @@
+namespace SiNan.Model.Dto
+{
+ public class ListResponse where T : class
+ {
+ public List ItemList { get; set; }
+
+ public long Count { get; set; }
+ }
+}
diff --git a/SiNan.Model/Dto/Response/Product/ProductSkuResponse.cs b/SiNan.Model/Dto/Response/Product/ProductSkuResponse.cs
new file mode 100644
index 0000000..f422528
--- /dev/null
+++ b/SiNan.Model/Dto/Response/Product/ProductSkuResponse.cs
@@ -0,0 +1,8 @@
+using SiNan.Model.Db;
+
+namespace SiNan.Model.Dto
+{
+ public class ProductSkuResponse : ProductSku
+ {
+ }
+}