diff --git a/src/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs b/src/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs
index d705d32..8e96d2a 100644
--- a/src/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs
+++ b/src/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs
@@ -15,6 +15,7 @@ using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
+
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
@@ -26,11 +27,15 @@ using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Web.Admin.Infrastructure;
+
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
+
using NPOI.HSSF.UserModel;
+
using SqlSugar;
+
using Yitter.IdGenerator;
namespace CoreCms.Net.Web.Admin.Controllers
@@ -619,17 +624,17 @@ namespace CoreCms.Net.Web.Admin.Controllers
///
///
///
- [HttpPost]
+ [HttpGet]
[Description("预览数据")]
- public async Task GetDetails([FromBody] FMIntId entity)
+ public async Task GetDetails([FromQuery] int id)
{
var jm = new AdminUiCallBack();
- var model = await _coreCmsGoodsServices.QueryByIdAsync(entity.id);
+ var model = await _coreCmsGoodsServices.QueryByIdAsync(id);
if (model == null)
{
jm.msg = "不存在此信息";
- jm.data = entity.id;
+ jm.data = id;
return jm;
}
diff --git a/src/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs b/src/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
index 1a146c2..bcf96a2 100644
--- a/src/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
+++ b/src/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
@@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar;
using CoreCms.Net.Utility.Helper;
+using NetTaste;
namespace CoreCms.Net.Web.WebApi.Controllers
{
@@ -94,7 +95,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
/// 获取所有商品分类栏目数据
///
///
- [HttpPost]
+ [HttpGet]
public async Task GetAllCategories()
{
var jm = new WebApiCallBack() { status = true };
@@ -145,9 +146,10 @@ namespace CoreCms.Net.Web.WebApi.Controllers
///
/// 根据查询条件获取分页数据
///
+ /// where={priceFrom:"最低价格",priceTo:"最高价格",catId:"分类",brandId:"品牌",labelId:"标签id",searchName:"商品名称"}
///
- [HttpPost]
- public async Task GetGoodsPageList([FromBody] FMPageByWhereOrder entity)
+ [HttpGet]
+ public async Task GetGoodsPageList([FromQuery] FMPageByWhereOrder entity)
{
var jm = new WebApiCallBack();
@@ -229,7 +231,17 @@ namespace CoreCms.Net.Web.WebApi.Controllers
where = where.And(p => p.name.Contains(obj.searchName));
}
}
-
+ if (string.IsNullOrWhiteSpace(entity.order))
+ {
+ if (!string.IsNullOrWhiteSpace(entity.where) && entity.where.StartsWith("catId"))
+ {
+ entity.order = "sort desc";
+ }
+ else
+ {
+ entity.order = "createTime desc";
+ }
+ }
//获取数据
var list = await _goodsServices.QueryPageForLinqAsync(where, entity.order, entity.page, entity.limit, false);
if (list.Any())
@@ -253,9 +265,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
entity.page,
list.TotalCount,
list.TotalPages,
- entity.limit,
- entity.where,
- entity.order,
+ //entity.limit,
+ //entity.where,
+ //entity.order,
brands
};
jm.msg = "数据调用成功!";
@@ -268,10 +280,10 @@ namespace CoreCms.Net.Web.WebApi.Controllers
///
/// 获取商品详情
///
- ///
+ ///
///
- [HttpPost]
- public async Task GetDetial([FromBody] FMIntId entity)
+ [HttpGet]
+ public async Task GetDetial([FromQuery] int id)
{
var jm = new WebApiCallBack();
@@ -281,7 +293,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
userId = _user.ID;
}
- var model = await _goodsServices.GetGoodsDetial(entity.id, userId, false);
+ var model = await _goodsServices.GetGoodsDetial(id, userId, false);
if (model == null)
{
jm.msg = "商品获取失败";
@@ -303,8 +315,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
///
///
///
- [HttpPost]
- public async Task GetProductInfo([FromBody] FMGetProductInfo entity)
+ [HttpGet]
+ public async Task GetProductInfo([FromQuery] FMGetProductInfo entity)
{
var jm = new WebApiCallBack();
@@ -373,8 +385,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
///
///
///
- [HttpPost]
- public async Task GetGoodsParams([FromBody] FMIntId entity)
+ [HttpGet]
+ public async Task GetGoodsParams([FromQuery] FMIntId entity)
{
var jm = new WebApiCallBack();
@@ -424,8 +436,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
/// 获取随机推荐商品
///
///
- [HttpPost]
- public async Task GetGoodsRecommendList([FromBody] FMIntId entity)
+ [HttpGet]
+ public async Task GetGoodsRecommendList([FromQuery] FMIntId entity)
{
if (entity.id <= 0)
{
diff --git a/src/CoreCms.Net.Web.WebApi/Doc.xml b/src/CoreCms.Net.Web.WebApi/Doc.xml
index 70c8a95..5af90b8 100644
--- a/src/CoreCms.Net.Web.WebApi/Doc.xml
+++ b/src/CoreCms.Net.Web.WebApi/Doc.xml
@@ -380,13 +380,14 @@
根据查询条件获取分页数据
+ where={priceFrom:"最低价格",priceTo:"最高价格",catId:"分类",brandId:"品牌",labelId:"标签id",searchName:"商品名称"}
-
+
获取商品详情
-
+
@@ -467,7 +468,7 @@
获取单个公告内容
-
+