Commit becbf729 authored by 吴春's avatar 吴春
parents 0beda736 32ed971a
......@@ -260,6 +260,21 @@ namespace Mall.Model.Extend.MarketingCenter
/// 轮播图
/// </summary>
public List<bannerDetailItem> banners { get; set; }
/// <summary>
/// 圆角
/// </summary>
public string radius { get; set; }
/// <summary>
/// 上下边距
/// </summary>
public string topAndBottom { get; set; }
/// <summary>
/// 左右边距
/// </summary>
public string leftAndRight { get; set; }
}
/// <summary>
......
......@@ -25,5 +25,15 @@ namespace Mall.Model.Extend.Product
/// 是否可以分享
/// </summary>
public int? IsForeignShare { get; set; }
/// <summary>
/// 父级分类编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 商品层级
/// </summary>
public int Tier { get; set; }
}
}
......@@ -69,6 +69,12 @@ namespace Mall.Model.Extend.Product
/// 分类ids
/// </summary>
public string CategoryIds { get; set; }
/// <summary>
/// 商品分类Id【HK0803新增】
/// </summary>
public int CategoryId { get; set; }
/// <summary>
/// 商品ids
/// </summary>
......
......@@ -3336,6 +3336,118 @@ namespace Mall.Module.Product
return list;
}
/// <summary>
/// 获取分类=>商品列表
/// </summary>
/// <param name="demodel">查询条件</param>
/// <returns></returns>
public List<object> GetGoodsListModule(RB_Goods_Extend demodel)
{
List<object> resultList = new List<object>();
List<RB_Product_Category_Extend> categoryList = product_CategoryRepository.GetList(new RB_Product_Category_Extend() { MallBaseId = demodel.MallBaseId, TenantId = demodel.TenantId });
var goodsList = goodsRepository.GetList(demodel);
if (categoryList!=null&& categoryList.Count>0)
{
var firstCategoryList = categoryList.Where(qitem=>qitem.Tier==1).ToList();
foreach (var firstItem in firstCategoryList)
{
var rootGoodsList = goodsList.Where(qitem => qitem.CategoryId == firstItem.Id).ToList();
var secondCategoryList = categoryList.Where(qitem => qitem.Tier == 2 && qitem.ParentId == firstItem.Id).ToList();
List<object> secondResultList = new List<object>();
foreach (var secondItem in secondCategoryList)
{
var secondGoodList = goodsList.Where(qitem => qitem.CategoryId == secondItem.Id).ToList();
List<object> thirdResultList = new List<object>();
var thirdCategoryList = categoryList.Where(qitem => qitem.Tier == 3 && qitem.ParentId == secondItem.Id).ToList();
foreach (var thirdItem in thirdCategoryList)
{
var thirdGoodList = goodsList.Where(qitem => qitem.CategoryId == thirdItem.Id).ToList();
thirdResultList.Add(new
{
PageId = thirdItem.Id + 100000,
PageName = thirdItem.Name,
PageUrl = "/pages/cats/cats?cat_id=" + thirdItem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = thirdItem.Name,
ParameterValue = "",
SubMenuList = thirdGoodList.Select(qitem => new
{
PageId = qitem.Id + 100000,
PageName = qitem.Name,
PageUrl = "/pages/goods/goods?id=" + qitem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = qitem.Name,
ParameterValue = "",
})
});
}
if (secondGoodList != null && secondGoodList.Count > 0)
{
thirdResultList.AddRange(secondGoodList.Select(qitem => new
{
PageId = qitem.Id + 100000,
PageName = qitem.Name,
PageUrl = "/pages/goods/goods?id=" + qitem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = qitem.Name,
ParameterValue = "",
}));
}
secondResultList.Add(new
{
PageId = secondItem.Id + 100000,
PageName = secondItem.Name,
PageUrl = "/pages/cats/cats?cat_id=" + secondItem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = secondItem.Name,
ParameterValue = "",
SubMenuList = thirdResultList,
});
}
if (rootGoodsList != null && rootGoodsList.Count > 0)
{
secondResultList.AddRange(rootGoodsList.Select(qitem => new
{
PageId = qitem.Id + 100000,
PageName = qitem.Name,
PageUrl = "/pages/goods/goods?id=" + qitem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = qitem.Name,
ParameterValue = "",
}));
}
resultList.Add(new
{
PageId = firstItem.Id + 100000,
PageName = firstItem.Name,
PageUrl = "/pages/cats/cats?cat_id=" + firstItem.Id,
PageType = Common.Enum.MallBase.PageTypeEnum.DiyPage,
IsParameter = 0,
TipText = "",
SelfPageName = firstItem.Name,
ParameterValue = "",
SubMenuList = secondResultList,
});
}
}
return resultList;
}
/// <summary>
/// 首页查询使用
/// </summary>
......
......@@ -164,9 +164,10 @@ where {where} group by g.Id order by {orderBy}";
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
}
string sql = $@"select g.* from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
where {where} group by g.Id order by g.CreateDate desc";
string sql = $@"
SELECT g.*,C.CategoryId
FROM RB_Goods g INNER JOIN rb_goods_category c on g.Id=c.GoodsId
WHERE {where} group by g.Id order by g.CreateDate desc";
return Get<RB_Goods_Extend>(sql).ToList();
}
......
......@@ -37,9 +37,10 @@ namespace Mall.Repository.Product
where += $@" and gc.{nameof(RB_Goods_Category.GoodsId)} in({dmodel.GoodsIds})";
}
string sql = $@"select gc.*,pc.Name as CategoryName,pc.IsForeignShare from RB_Goods_Category gc
inner join rb_product_category pc on gc.CategoryId=pc.Id
where {where} order by gc.Id desc";
string sql = $@"
SELECT gc.*,pc.Name as CategoryName,pc.IsForeignShare,pc.ParentId,pc.Tier
FROM RB_Goods_Category gc inner join rb_product_category pc on gc.CategoryId=pc.Id
WHERE {where} ORDER BY gc.Id DESC ";
return Get<RB_Goods_Category_Extend>(sql).ToList();
}
}
......
......@@ -1242,6 +1242,9 @@ namespace Mall.WebApi.Controllers.User
/// <returns></returns>
public ApiResult GetMiniprogramPageListExt()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
//是否隐藏商品【1-隐藏】
int IsHiddenGoods = parms.GetInt("IsHiddenGoods");
List<object> resultList = new List<object>();
var pageList = programPageModule.GetMiniprogram_Page_ListExtModule(new RB_MiniProgram_Page_Extend() { MallBaseId = RequestParm.MallBaseId });
var pageTypeList = Common.Plugin.EnumHelper.EnumToList(typeof(PageTypeEnum));
......@@ -1266,6 +1269,34 @@ namespace Mall.WebApi.Controllers.User
.ToList()
});
}
int MallBaseId = -1;
if (UserInfo.MallBaseId > 0)
{
MallBaseId = UserInfo.MallBaseId;
}
if (MallBaseId == -1)
{
if (RequestParm.MallBaseId > 0)
{
MallBaseId = RequestParm.MallBaseId;
}
}
if (IsHiddenGoods == 0)
{
var categoryList = productModule.GetGoodsListModule(new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = RequestParm.TenantId,
MallBaseId = MallBaseId,
GoodsStatus = 1,
});
//新增商品选项卡
resultList.Add(new
{
PageTypeName = "商品",
PageTypeId = 6,
SubMenuList = categoryList
});
}
return ApiResult.Success(data: resultList);
}
......
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