Commit 7eff8193 authored by liudong1993's avatar liudong1993
parents 4ccb2bf9 c47bbd5d
......@@ -16,5 +16,20 @@ namespace Mall.Model.Extend.MarketingCenter
/// 分类Id
/// </summary>
public string QCateIds { get; set; }
/// <summary>
/// 分类列表
/// </summary>
public List<RB_Share_Category_Extend> CateList { get; set; }
/// <summary>
/// 一级分类名称
/// </summary>
public string FirstLevelName { get; set; }
/// <summary>
/// 二级分类名称
/// </summary>
public string SecondLevelName { get; set; }
}
}
using Mall.Model.Entity.MarketingCenter;
using System;
using System.Collections.Generic;
using VT.FW.DB;
namespace Mall.Model.Extend.MarketingCenter
......@@ -41,5 +42,10 @@ namespace Mall.Model.Extend.MarketingCenter
return Convert.ToDateTime(this.CreateDate).ToString("yyyy-MM-dd HH:mm:ss");
}
}
/// <summary>
/// 分类列表
/// </summary>
public List<RB_Share_Category_Extend> CateList { get; set; }
}
}
\ No newline at end of file
......@@ -99,6 +99,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public List<RB_Share_Friend_Extend> GetShareFriendPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Share_Friend_Extend query)
{
var cateAllList = share_CategoryRepository.GetShareCategoryListRepository(new RB_Share_Category_Extend()
{
MallBaseId = query.MallBaseId,
TenantId = query.TenantId
});
if (query.CateId > 0)
{
var cateList = GetChildCategoryListModule(new RB_Share_Category_Extend() { QCateIds = query.CateId.ToString() });
......@@ -106,10 +111,28 @@ namespace Mall.Module.MarketingCenter
query.CateIds = string.Join(",", cateList.Select(qitem => qitem.Id));
}
var list = share_FriendRepository.GetShareFriendPageListRepository(pageIndex, pageSize, out rowsCount, query);
foreach (var item in list)
{
item.CateList = GetFatherList(cateAllList, item.CateId).OrderBy(qitem => qitem.Level).ToList();
}
return list;
}
/// <summary>
/// 获取所有上级分类
/// </summary>
/// <param name="list"></param>
/// <param name="Id"></param>
/// <returns></returns>
public static IEnumerable<RB_Share_Category_Extend> GetFatherList(IList<RB_Share_Category_Extend> list, int Id)
{
var query = list.Where(p => p.Id == Id).ToList();
return query.ToList().Concat(query.ToList().SelectMany(t => GetFatherList(list, t.ParentId)));
}
/// <summary>
/// 获取分享详情列表
/// </summary>
......@@ -120,6 +143,25 @@ namespace Mall.Module.MarketingCenter
return share_FriendRepository.GetShareFriendListRepository(query);
}
/// <summary>
/// 批量修改排序
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public bool SetShareCategorySortListModule(List<RB_Share_Category_Extend> list)
{
bool flag = false;
foreach (var extModel in list)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Category_Extend.SortNum),extModel.SortNum },
};
flag = share_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Category_Extend.Id), extModel.Id));
}
return flag;
}
/// <summary>
/// 新增修改分类
/// </summary>
......@@ -172,7 +214,19 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public RB_Share_Category_Extend GetShareCategoryModule(object Id)
{
return share_CategoryRepository.GetEntity<RB_Share_Category_Extend>(Id);
var extModel = share_CategoryRepository.GetEntity<RB_Share_Category_Extend>(Id);
if (extModel != null)
{
var cateAllList = share_CategoryRepository.GetShareCategoryListRepository(new RB_Share_Category_Extend()
{
MallBaseId = extModel.MallBaseId,
TenantId = extModel.TenantId
});
var list= GetFatherList(cateAllList, extModel.Id).OrderBy(qitem => qitem.Level).ToList();
extModel.FirstLevelName = list.Where(qitem=>qitem.Level==1)?.FirstOrDefault()?.Name??"";
extModel.SecondLevelName = list.Where(qitem => qitem.Level == 2)?.FirstOrDefault()?.Name ?? "";
}
return extModel;
}
/// <summary>
......@@ -241,7 +295,7 @@ namespace Mall.Module.MarketingCenter
/// <param name="Id"></param>
/// <param name="IsTop"></param>
/// <returns></returns>
public bool SetShareFriendIsTopModule(object Id,int IsTop)
public bool SetShareFriendIsTopModule(object Id, int IsTop)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
......
......@@ -71,6 +71,17 @@ namespace Mall.WebApi.Controllers.MarketingCenter
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 批量修改排序
/// </summary>
/// <returns></returns>
public ApiResult SetShareCategorySortList()
{
var list = JsonConvert.DeserializeObject<List<RB_Share_Category_Extend>>(RequestParm.msg.ToString());
bool flag = shareModule.SetShareCategorySortListModule(list);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 删除分享分类
/// </summary>
......
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