|
@@ -239,65 +239,101 @@ namespace MySystem.Controllers
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
- List<string> ordernos = new List<string>();
|
|
|
|
|
- ordernos.Add("BM2023121215501796424073091");
|
|
|
|
|
- foreach(string orderno in ordernos)
|
|
|
|
|
|
|
+ List<int> ids = new List<int>();
|
|
|
|
|
+ ids.Add(10);
|
|
|
|
|
+ ids.Add(11);
|
|
|
|
|
+ ids.Add(77);
|
|
|
|
|
+ ids.Add(78);
|
|
|
|
|
+ ids.Add(79);
|
|
|
|
|
+ DateTime Start = DateTime.Parse("2023-12-10 00:00:00");
|
|
|
|
|
+ List<Orders> orders = db.Orders.Where(m => m.Status > 0 && m.CreateDate >= Start && ids.Contains(m.ProductId)).ToList();
|
|
|
|
|
+ foreach(Orders order in orders)
|
|
|
{
|
|
{
|
|
|
- Orders order = db.Orders.FirstOrDefault(m => m.OrderNo == orderno);
|
|
|
|
|
- if(order != null)
|
|
|
|
|
|
|
+ OrderProduct pro = db.OrderProduct.FirstOrDefault(m => m.OrderId == order.Id) ?? new OrderProduct();
|
|
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId) ?? new Users();
|
|
|
|
|
+ List<int> prizeChk = new List<int>();
|
|
|
|
|
+ if(!db.UserAccountRecord.Any(m => m.ChangeType == 112 && m.QueryCount == order.Id))
|
|
|
|
|
+ {
|
|
|
|
|
+ prizeChk.Add(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!db.UserAccountRecord.Any(m => m.ChangeType == 118 && m.QueryCount == order.Id))
|
|
|
|
|
+ {
|
|
|
|
|
+ prizeChk.Add(2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!db.LeaderAccountRecord.Any(m => m.QueryCount == order.Id))
|
|
|
{
|
|
{
|
|
|
- OrderProduct pro = db.OrderProduct.FirstOrDefault(m => m.OrderId == order.Id) ?? new OrderProduct();
|
|
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId) ?? new Users();
|
|
|
|
|
- int ParentUserId = user.ParentUserId;
|
|
|
|
|
- bool buyPrize = false;
|
|
|
|
|
- bool OncePrizeFlag4 = true;
|
|
|
|
|
- int leaderFlag = 0;
|
|
|
|
|
- bool DirectPrizeFlag = true;
|
|
|
|
|
- if(user.LeaderLevel > 0 || user.UserType == 1) //盟主或运营中心
|
|
|
|
|
|
|
+ prizeChk.Add(3);
|
|
|
|
|
+ }
|
|
|
|
|
+ int ParentUserId = user.ParentUserId;
|
|
|
|
|
+ bool buyPrize = false;
|
|
|
|
|
+ bool OncePrizeFlag4 = true;
|
|
|
|
|
+ int leaderFlag = 0;
|
|
|
|
|
+ bool DirectPrizeFlag = true;
|
|
|
|
|
+ if(user.LeaderLevel > 0 || user.UserType == 1) //盟主或运营中心
|
|
|
|
|
+ {
|
|
|
|
|
+ //推荐奖励
|
|
|
|
|
+ if(prizeChk.Contains(1))
|
|
|
{
|
|
{
|
|
|
- //推荐奖励
|
|
|
|
|
- // AlipayPayBack2Service.Instance.DirectPrize(db, order.Id, order.UserId, pro.ProductCount);
|
|
|
|
|
- DirectPrizeFlag = false;
|
|
|
|
|
|
|
+ AlipayPayBack2Service.Instance.DirectPrize(db, order.Id, order.UserId, pro.ProductCount);
|
|
|
}
|
|
}
|
|
|
- while (ParentUserId > 0)
|
|
|
|
|
|
|
+ DirectPrizeFlag = false;
|
|
|
|
|
+ UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == order.UserId) ?? new UserAccount();
|
|
|
|
|
+ if (acccount.LeaderReserve >= 400 * pro.ProductCount && !buyPrize)
|
|
|
{
|
|
{
|
|
|
- Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
|
|
|
|
|
- if(DirectPrizeFlag)
|
|
|
|
|
|
|
+ //购机奖励
|
|
|
|
|
+ if(prizeChk.Contains(2))
|
|
|
{
|
|
{
|
|
|
- // AlipayPayBack2Service.Instance.DirectPrize(db, order.Id, ParentUserId, pro.ProductCount);
|
|
|
|
|
- DirectPrizeFlag = false;
|
|
|
|
|
|
|
+ AlipayPayBack2Service.Instance.OpAccount(db, order, order.UserId, 100, 1);
|
|
|
}
|
|
}
|
|
|
- if (puser.LeaderLevel > 0)
|
|
|
|
|
|
|
+ buyPrize = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ while (ParentUserId > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
|
|
|
|
|
+ if(DirectPrizeFlag)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(prizeChk.Contains(1))
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id) ?? new UserAccount();
|
|
|
|
|
- if (acccount.LeaderReserve >= 400 * pro.ProductCount && !buyPrize)
|
|
|
|
|
|
|
+ AlipayPayBack2Service.Instance.DirectPrize(db, order.Id, ParentUserId, pro.ProductCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ DirectPrizeFlag = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (puser.LeaderLevel > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id) ?? new UserAccount();
|
|
|
|
|
+ if (acccount.LeaderReserve >= 400 * pro.ProductCount && !buyPrize)
|
|
|
|
|
+ {
|
|
|
|
|
+ //购机奖励
|
|
|
|
|
+ if(prizeChk.Contains(2))
|
|
|
{
|
|
{
|
|
|
- //购机奖励
|
|
|
|
|
AlipayPayBack2Service.Instance.OpAccount(db, order, puser.Id, 100, 1);
|
|
AlipayPayBack2Service.Instance.OpAccount(db, order, puser.Id, 100, 1);
|
|
|
- buyPrize = true;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ buyPrize = true;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (acccount.LeaderReserve >= 400 * pro.ProductCount && puser.LeaderLevel > leaderFlag && leaderFlag < 2 && OncePrizeFlag4)
|
|
|
|
|
|
|
+ if (acccount.LeaderReserve >= 400 * pro.ProductCount && puser.LeaderLevel > leaderFlag && leaderFlag < 2 && OncePrizeFlag4)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(prizeChk.Contains(3))
|
|
|
{
|
|
{
|
|
|
//扣减备用金
|
|
//扣减备用金
|
|
|
AlipayPayBack2Service.Instance.OpReserve(db, order, puser.Id, 400 * pro.ProductCount, 2, order.UserId, "购机奖励");
|
|
AlipayPayBack2Service.Instance.OpReserve(db, order, puser.Id, 400 * pro.ProductCount, 2, order.UserId, "购机奖励");
|
|
|
//返回到余额
|
|
//返回到余额
|
|
|
AlipayPayBack2Service.Instance.OpLeaderAccount(db, order, puser.Id, 400, pro.ProductCount);
|
|
AlipayPayBack2Service.Instance.OpLeaderAccount(db, order, puser.Id, 400, pro.ProductCount);
|
|
|
- leaderFlag = puser.LeaderLevel;
|
|
|
|
|
- OncePrizeFlag4 = false;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ leaderFlag = puser.LeaderLevel;
|
|
|
|
|
+ OncePrizeFlag4 = false;
|
|
|
}
|
|
}
|
|
|
- ParentUserId = puser.ParentUserId;
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //购买盟主奖励
|
|
|
|
|
- // decimal Prize = decimal.Parse(function.CheckNum(PublicFunction.GetPublicParam(db, "BigLeaderPrize")));
|
|
|
|
|
- // if(Prize > 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // AlipayPayBack2Service.Instance.LeaderRecommendPrize(db, order, 565, Prize, 122);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ ParentUserId = puser.ParentUserId;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //购买盟主奖励
|
|
|
|
|
+ // decimal Prize = decimal.Parse(function.CheckNum(PublicFunction.GetPublicParam(db, "BigLeaderPrize")));
|
|
|
|
|
+ // if(Prize > 0)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // AlipayPayBack2Service.Instance.LeaderRecommendPrize(db, order, 565, Prize, 122);
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
db.Dispose();
|
|
db.Dispose();
|
|
|
|
|
|