|
@@ -267,30 +267,41 @@ namespace MySystem
|
|
|
return;
|
|
|
}
|
|
|
int ParentUserId = user.ParentUserId;
|
|
|
+ List<int> proids = new List<int>();
|
|
|
+ proids.Add(10);
|
|
|
+ proids.Add(11);
|
|
|
while(ParentUserId > 0)
|
|
|
{
|
|
|
Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
|
|
|
int machineCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.PosSnType == 0); //判断是否拥有3台购买机
|
|
|
int ActiveCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
|
|
|
int couponCount = db.PosCoupons.Count(m => m.UserId == ParentUserId && m.IsUse == 0); //判断是否拥有3张券
|
|
|
- function.WriteLog("MakerCode:" + user.MakerCode, "推荐下单奖励监控日志");
|
|
|
+ function.WriteLog("MakerCode:" + puser.MakerCode, "推荐下单奖励监控日志");
|
|
|
function.WriteLog("machineCount:" + machineCount, "推荐下单奖励监控日志");
|
|
|
function.WriteLog("ActiveCount:" + ActiveCount, "推荐下单奖励监控日志");
|
|
|
if ((machineCount + ActiveCount + couponCount >= 3 || puser.LeaderLevel > 0) && !directPrize)
|
|
|
{
|
|
|
function.WriteLog("满足条件", "推荐下单奖励监控日志");
|
|
|
- if(puser.LeaderLevel == 0) // 非盟主直推奖励,每个上级创客只能获得一次
|
|
|
+ if(puser.LeaderLevel == 0) // 非盟主直推奖励,每个创客第一次下单,上级可得
|
|
|
{
|
|
|
- bool check = db.UserAccountRecord.Any(m => m.UserId == ParentUserId && m.ChangeType == 112);
|
|
|
+ List<int> oids = new List<int>();
|
|
|
+ var orderpros = db.OrderProduct.Select(m => new { m.OrderId,m.UserId,m.ProductId }).Where(m => m.UserId == order.UserId && proids.Contains(m.ProductId)).ToList();
|
|
|
+ foreach(var orderpro in orderpros)
|
|
|
+ {
|
|
|
+ oids.Add(orderpro.OrderId);
|
|
|
+ }
|
|
|
+ bool check = db.Orders.Any(m => oids.Contains(m.Id) && m.Status > 0);
|
|
|
if(!check)
|
|
|
{
|
|
|
DirectPrize(db, order.Id, ParentUserId, pro.ProductCount);
|
|
|
+ directPrize = true;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// 盟主直推奖励,可以每次下单获得
|
|
|
DirectPrize(db, order.Id, ParentUserId, pro.ProductCount);
|
|
|
+ directPrize = true;
|
|
|
}
|
|
|
|
|
|
//推荐下单上级获得30天的机具循环天数
|
|
@@ -304,7 +315,6 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
- directPrize = true;
|
|
|
}
|
|
|
if(puser.LeaderLevel > 0)
|
|
|
{
|
|
@@ -351,6 +361,12 @@ namespace MySystem
|
|
|
{
|
|
|
RecommendMethod(order.UserId, order.CreateDate.Value.ToString("yyyyMM"));
|
|
|
}
|
|
|
+ //分仓向总仓申请机具额度
|
|
|
+ if(pro.ProductId == 24 || pro.ProductId == 25 || pro.ProductId == 26)
|
|
|
+ {
|
|
|
+ string SendData = "{\"Kind\":\"1\",\"Data\":{\"OrderId\":\"" + order.Id + "\"}}";
|
|
|
+ RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|