Commit 0c9ee628 authored by 吴春's avatar 吴春

提交代码

parent 8a4c72c4
...@@ -138,5 +138,7 @@ namespace Mall.Common.Data ...@@ -138,5 +138,7 @@ namespace Mall.Common.Data
/// 状态 /// 状态
/// </summary> /// </summary>
public int S { get; set; } public int S { get; set; }
public List<Node> Children { get; set; }
} }
} }
...@@ -80,5 +80,7 @@ namespace Mall.Model.Extend.BaseSetUp ...@@ -80,5 +80,7 @@ namespace Mall.Model.Extend.BaseSetUp
/// 批量name查询 /// 批量name查询
/// </summary> /// </summary>
public string NameStr { get; set; } public string NameStr { get; set; }
public List<RB_Destination_Extend> Children { get; set; }
} }
} }
...@@ -162,9 +162,9 @@ namespace Mall.Module.BaseSetUp ...@@ -162,9 +162,9 @@ namespace Mall.Module.BaseSetUp
/// 获取列表 /// 获取列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<Mall.Common.Data.Node> GetAllList() public List<RB_Destination_Extend> GetAllList()
{ {
return rb_DestinationRepository.GetAllList(); return rb_DestinationRepository.GetAllDestinationList();
} }
/// <summary> /// <summary>
......
...@@ -234,6 +234,22 @@ SELECT * FROM {0} WHERE 1=1 AND ParentID<>2 {1} ...@@ -234,6 +234,22 @@ SELECT * FROM {0} WHERE 1=1 AND ParentID<>2 {1}
return queryList; return queryList;
} }
/// <summary>
/// 获取地区列表
/// </summary>
/// <returns></returns>
public List<RB_Destination_Extend> GetAllDestinationList()
{
List<Common.Data.Node> queryList = new List<Common.Data.Node>();
StringBuilder sb = new StringBuilder();
sb.AppendFormat("SELECT * FROM {0} WHERE 1=1 ", TableName);
sb.AppendFormat(" AND {0}={1} ", nameof(RB_Destination_Extend.Status), (int)Common.Enum.DateStateEnum.Normal);
List<RB_Destination_Extend> list = Get<RB_Destination_Extend>(sb.ToString()).ToList();
return list;
}
/// <summary> /// <summary>
/// 根据Ids获取地区名称 /// 根据Ids获取地区名称
/// </summary> /// </summary>
......
...@@ -3,7 +3,9 @@ using System.Collections.Generic; ...@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Mall.Common.API; using Mall.Common.API;
using Mall.Common.Data;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Extend.BaseSetUp;
using Mall.Module.BaseSetUp; using Mall.Module.BaseSetUp;
using Mall.WebApi.Filter; using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
...@@ -29,7 +31,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -29,7 +31,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <param name="ParentID">父节点编号</param> /// <param name="ParentID">父节点编号</param>
/// <returns></returns> /// <returns></returns>
public ApiResult GetChildList() public ApiResult GetChildList()
{ {
JObject parm = JObject.Parse(RequestParm.msg.ToString()); JObject parm = JObject.Parse(RequestParm.msg.ToString());
int ID = parm.GetInt("Id"); int ID = parm.GetInt("Id");
...@@ -48,5 +50,42 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -48,5 +50,42 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed("未找到相关数据!"); return ApiResult.Failed("未找到相关数据!");
} }
} }
[HttpPost]
public ApiResult GetAllList()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
var list = destinationModule.GetAllList();
var result = GetData(list);
return ApiResult.Success("", result);
}
public static List<RB_Destination_Extend> GetData(List<RB_Destination_Extend> nodeList)
{
List<RB_Destination_Extend> nodes = nodeList.Where(x => x.ParentID == 2).ToList();
foreach (RB_Destination_Extend item in nodes)
{
item.Children = GetChildrens(nodeList, item);
}
return nodes;
}
//递归获取子节点
public static List<RB_Destination_Extend> GetChildrens(List<RB_Destination_Extend> nodeList, RB_Destination_Extend node)
{
List<RB_Destination_Extend> childrens = nodeList.Where(x => x.ParentID == node.ID).ToList();
foreach (RB_Destination_Extend item in childrens)
{
item.Children = GetChildrens(nodeList, item);
}
return childrens;
}
} }
} }
\ No newline at end of file
...@@ -274,6 +274,14 @@ namespace Mall.WebApi.Controllers.MarketingCenter ...@@ -274,6 +274,14 @@ namespace Mall.WebApi.Controllers.MarketingCenter
} }
} }
if (query.CouponType == CouponTypeEnum.Discount)
{
if (query.DiscountsPrice > 10)
{
return ApiResult.Failed("折扣率的值必须不大于10");
}
}
if (query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Category || query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Product) if (query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Category || query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Product)
{ {
......
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