【新增】增加商品列表dto类及查询方法,首页【商品组件】【商品tab组】【仿点餐界面】【栏目列表页】【推荐商品列表】进行替换。

【优化】优化普通商品及营销商品内页不同dom之间间距。微调其他页面样式
【调整】移除.net5升级到.net6保留的startup.cs文件,使用program.cs
This commit is contained in:
大灰灰
2022-11-06 05:38:42 +08:00
parent 84fbcfffbd
commit 45877f0d5c
23 changed files with 1316 additions and 819 deletions

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.DTO.ComponentsDTO;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
@@ -26,7 +27,9 @@ using CoreCms.Net.Utility.Extensions;
using Essensoft.Paylink.Alipay.Domain;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using static NPOI.HSSF.Util.HSSFColor;
namespace CoreCms.Net.Services
@@ -267,10 +270,7 @@ namespace CoreCms.Net.Services
foreach (var jToken in list)
{
var child = (JObject)jToken;
var where = PredicateBuilder.True<CoreCmsGoods>();
where = where.And(p => p.isDel == false);
where = where.And(p => p.isMarketable == true);
var where = PredicateBuilder.True<GoodListDTO>();
if (child != null && child.ContainsKey("type") && child["type"].ToString() == "auto")
{
//商品分类,同时取所有子分类
@@ -301,7 +301,8 @@ namespace CoreCms.Net.Services
}
limit = limit > 0 ? limit : 10;
var goods = await _goodsServices.QueryListByClauseAsync(where, limit, p => p.createTime, OrderByType.Desc, true);
var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, p => p.createTime, OrderByType.Desc, true, true, 60);
if (goods != null && goods.Any())
{
var result = JArray.FromObject(goods);
@@ -318,6 +319,7 @@ namespace CoreCms.Net.Services
{
var orderBy = string.Empty;
string goodidsStr;
var count = 0;
if (child != null && child.ContainsKey("list"))
{
var result = JArray.Parse(child["list"].ToString());
@@ -335,9 +337,11 @@ namespace CoreCms.Net.Services
{
orderBy = " find_in_set(id,'" + goodidsStr + "') ";
}
count = goodids.Count;
}
}
var goods = await _goodsServices.QueryListByClauseAsync(where, orderBy, true);
var goods = await _goodsServices.QueryListByComponentsAsync(where, count, orderBy, true, true, 60);
if (goods != null && goods.Any())
{
var result = JArray.FromObject(goods);
@@ -364,9 +368,7 @@ namespace CoreCms.Net.Services
case "goods":
{
var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters);
var where = PredicateBuilder.True<CoreCmsGoods>();
where = where.And(p => p.isDel == false);
where = where.And(p => p.isMarketable == true);
var where = PredicateBuilder.True<GoodListDTO>();
if (parameters != null && parameters.ContainsKey("type") && parameters["type"].ToString() == "auto")
{
//商品分类,同时取所有子分类
@@ -397,7 +399,7 @@ namespace CoreCms.Net.Services
}
limit = limit > 0 ? limit : 10;
var goods = await _goodsServices.QueryPageAsync(where, " sort desc,id desc ", 1, limit, true);
var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, " sort desc,id desc ", true, true, 60);
if (goods != null && goods.Any())
{
var result = JArray.FromObject(goods);
@@ -414,9 +416,10 @@ namespace CoreCms.Net.Services
{
var orderBy = string.Empty;
string goodidsStr;
var count = 0;
if (parameters != null && parameters.ContainsKey("list"))
{
JArray result = JArray.Parse(parameters["list"].ToString());
var result = JArray.Parse(parameters["list"].ToString());
var goodids = new List<int>();
foreach (var ss in result) //查找某个字段与值
{
@@ -440,11 +443,12 @@ namespace CoreCms.Net.Services
orderBy = " find_in_set(id,'" + goodidsStr + "') ";
}
}
count = goodids.Count;
}
var goods = await _goodsServices.QueryListByClauseAsync(where, orderBy, true);
var goods = await _goodsServices.QueryListByComponentsAsync(where, count, orderBy, true, true, 60);
if (goods != null && goods.Any())
{
JArray result = JArray.FromObject(goods);
var result = JArray.FromObject(goods);
parameters.Remove("list");
parameters.Add("list", result);
}