Commit d12e8a0b authored by liudong1993's avatar liudong1993

1

parent c64260ec
......@@ -2932,7 +2932,52 @@ namespace Mall.Module.Product
}
}
/// <summary>
/// 初始化返佣
/// </summary>
/// <param name="orderId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public bool SetAppletOrderCommissionInitialize(int orderId,int userId=0)
{
var demodel = goods_OrderRepository.GetEntity<RB_Goods_Order_Extend>(orderId);
if (demodel == null)
{
return false;
}
userId = demodel.UserId ?? 0;
var umodel = member_UserRepository.GetEntity(userId);
if (umodel == null)
{
return false;
}
var detList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = orderId });
demodel.DetailList = detList;
string GoodsIds = "";
if (demodel.DetailList.Any()) {
GoodsIds = string.Join(",", demodel.DetailList.Select(x => x.GoodsId));
var gList = goodsRepository.GetList(new RB_Goods_Extend() { GoodsIds = GoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
foreach (var item in demodel.DetailList)
{
var gmodel = gList.Where(x => x.Id == item.GoodsId).FirstOrDefault();
if (gmodel == null || gmodel.GoodsStatus != 1)
{
return false;
}
item.SeparateDistribution = gmodel.SeparateDistribution;
item.SeparateDistributionType = gmodel.SeparateDistributionType;
item.SeparateDistributionMoneyType = gmodel.SeparateDistributionMoneyType;
item.IntegralPresent = gmodel.IntegralPresent;
item.IntegralPresentType = gmodel.IntegralPresentType;
}
}
InsertOrderCommission(demodel, umodel, GoodsIds, orderId);
return true;
}
/// <summary>
/// 插入返佣
......@@ -3166,6 +3211,14 @@ namespace Mall.Module.Product
}
if (OneUserId > 0)
{
#region 临时处理
if (TwoUserId > 0 && TwoUserId < 20) {
TwoUserId = 0;
}
if (ThreeUserId > 0 && ThreeUserId < 20) {
ThreeUserId = 0;
}
#endregion
if (OneUserId > 0)
{
OneDistributorGrade = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserId = OneUserId })?.FirstOrDefault()?.GradeId ?? 0;
......@@ -3428,9 +3481,9 @@ namespace Mall.Module.Product
//gocList 合并用户金额
if (basicModel.IsCommissionResidue == 1)
{
gocfulList = new List<RB_Goods_OrderCommission>();
if (gocList.Count() != gocList.Select(x => x.UserId).Distinct().Count())
{
gocfulList = new List<RB_Goods_OrderCommission>();
//说明有用户可以合并
var userIdList = gocList.Select(x => x.UserId).Distinct().ToList();
foreach (var qitem in userIdList)
......@@ -3450,6 +3503,7 @@ namespace Mall.Module.Product
{
foreach (var qitem in gocfulList)
{
qitem.Commission = (qitem.Commission ?? 0) * (item.Number ?? 0);
goods_OrderCommissionRepository.Insert(qitem, trans);
}
}
......
......@@ -3205,6 +3205,48 @@ namespace Mall.Module.Product
return list;
}
/// <summary>
/// 首页查询使用
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetProductGoodsPageList_V2(int pageIndex, int pageSize, out long count, RB_Goods_Extend demodel)
{
if (!string.IsNullOrEmpty(demodel.CategoryIds) && !demodel.CategoryIds.Contains(','))
{
//获取该分类下所有子集分类
var cmodel = goods_CategoryRepository.GetEntity(demodel.CategoryIds);
//goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { TenantId });
}
var list = goodsRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any())
{
//查询分类
string ids = string.Join(",", list.Select(x => x.Id));
var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var olist = goods_OrderRepository.GetGoodsOrderNum(ids);
foreach (var item in list)
{
item.CategoryList = clist.Where(x => x.GoodsId == item.Id).ToList();
//轮播图
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图
item.CoverImage = CarouselIdList[0];
//轮播图
}
item.GoodsBuyNum = olist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0;
}
}
return list;
}
/// <summary>
/// 获取后台商品代理分页列表
/// </summary>
......
......@@ -480,6 +480,20 @@ namespace Mall.WebApi.Controllers.MallBase
return orderModule.SetAppletGoodsOrderInfo(demodel);
}
/// <summary>
/// 返佣初始化
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetAppletOrderCommissionInitialize() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);
bool flag = orderModule.SetAppletOrderCommissionInitialize(OrderId);
return ApiResult.Success("", flag);
}
/// <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