Commit 14a15218 authored by 吴春's avatar 吴春

提交代码

parent 238cb0f7
......@@ -246,6 +246,17 @@ namespace Mall.Module.Product
}
string goodsIds2 = string.Join(",", list.Select(x => x.Id));
List<RB_Goods_Order_Extend> orderlist = goods_OrderRepository.GetGoodsOrderNum(goodsIds: goodsIds2);
//2020-08-06 Add by:W 查询商品分类获取分类包邮规则
string allGoodsIds = string.Join(",", list.Select(x => x.Id));
var goodsCategoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = allGoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
string categoryIds = string.Join(",", goodsCategoryList.Select(x => x.CategoryId).Distinct());
List<RB_FreeShipping_Extend> freeShippingList = new List<RB_FreeShipping_Extend>();
if (!string.IsNullOrWhiteSpace(categoryIds))
{
freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = demodel.MallBaseId, TenantId = demodel.TenantId, CategoryIds = categoryIds });
}
//2020-08-06 Add by:W End
foreach (var item in list)
{
item.CoverImage = "";
......@@ -269,7 +280,35 @@ namespace Mall.Module.Product
}
item.SalesNum += (orderlist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0);
//2020-08-06 Add by:W 查询商品分类获取分类包邮规则
if (freeShippingList != null && freeShippingList.Any())
{
var nowcategory = goodsCategoryList.Where(x => x.GoodsId == item.Id).Select(x => x.CategoryId);
var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
item.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
else
{
item.FreeShippingModel = new RB_FreeShipping_Extend();
}
//2020-08-06 Add by:W End
}
}
return list;
}
......@@ -1059,7 +1098,7 @@ namespace Mall.Module.Product
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = model.MallBaseId, TenantId = model.TenantId, CategoryIds = categoryIds });
if (freeShippingList != null && freeShippingList.Any())
{
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x=>x.ID).FirstOrDefault();
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment