|
@@ -214,6 +214,82 @@ namespace MySystem
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public void tmpuse()
|
|
|
+ {
|
|
|
+ List<int> ChkIds = new List<int>(); //机具券商品Id集合
|
|
|
+ ChkIds.Add(10);
|
|
|
+ ChkIds.Add(11);
|
|
|
+ ChkIds.Add(77);
|
|
|
+ ChkIds.Add(78);
|
|
|
+ ChkIds.Add(79);
|
|
|
+ ChkIds.Add(92);
|
|
|
+ DateTime chkDate = DateTime.Parse("2024-06-01 00:00:00");
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
|
|
|
+ List<Orders> orders = db.Orders.Where(m => m.CreateDate >= chkDate && ChkIds.Contains(m.ProductId) && m.Status > 0).ToList();
|
|
|
+ foreach(Orders order in orders)
|
|
|
+ {
|
|
|
+ int Kind = 0;
|
|
|
+ if (order.ProductId == 10)
|
|
|
+ {
|
|
|
+ Kind = 1;
|
|
|
+ }
|
|
|
+ else if (order.ProductId == 11)
|
|
|
+ {
|
|
|
+ Kind = 2;
|
|
|
+ }
|
|
|
+ int CouponCount = 0;
|
|
|
+ if(Kind == 1)
|
|
|
+ {
|
|
|
+ CouponCount = 3 * order.BuyCount;
|
|
|
+ }
|
|
|
+ else if(Kind == 2)
|
|
|
+ {
|
|
|
+ CouponCount = 2 * order.BuyCount;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserAccountRecord record = db.UserAccountRecord.FirstOrDefault(m => m.Id >= 4579675 && m.QueryCount == order.Id && m.ChangeType == 112) ?? new UserAccountRecord();
|
|
|
+
|
|
|
+ UserRankItem orderUser = GetUserLevel(order.UserId);
|
|
|
+ if(orderUser.UserLevel == 0)
|
|
|
+ {
|
|
|
+ PreUserLevel(db, order.UserId, 1, DateTime.Parse("2025-01-01 00:00:00"));
|
|
|
+ }
|
|
|
+ string ParentNav = orderUser.ParentNav + "," + orderUser.Id + ",";
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ Array.Reverse(ParentNavList);
|
|
|
+ int index = 0;
|
|
|
+ bool DirectPrizeFlag = false; //推荐奖励发放标识
|
|
|
+ foreach(string ParentId in ParentNavList)
|
|
|
+ {
|
|
|
+ UserRankItem parentUser = GetUserLevel(int.Parse(ParentId));
|
|
|
+ index += 1;
|
|
|
+ if(index == 1 && (orderUser.LeaderLevel > 0 || orderUser.OperateLevel > 0) && !DirectPrizeFlag)
|
|
|
+ {
|
|
|
+ // DirectPrize(db, order.Id, order.UserId, order.BuyCount);
|
|
|
+ if(record.UserId != order.UserId) function.WriteLog("下单人--订单号:" + order.OrderNo + ";应发对象:" + order.UserId + ";实发对象:" + record.UserId + ";发放金额:" + order.BuyCount + "00;", "推荐奖励计算");
|
|
|
+ DirectPrizeFlag = true;
|
|
|
+ }
|
|
|
+ if(index > 1)
|
|
|
+ {
|
|
|
+ if(Utils.Instance.IsStandardUser(parentUser.Id) && !DirectPrizeFlag)
|
|
|
+ {
|
|
|
+ // DirectPrize(db, order.Id, parentUser.Id, order.BuyCount);
|
|
|
+ if(record.UserId != parentUser.Id) function.WriteLog("上级--订单号:" + order.OrderNo + ";应发对象:" + parentUser.Id + ";实发对象:" + record.UserId + ";发放金额:" + order.BuyCount + "00;", "推荐奖励计算");
|
|
|
+ DirectPrizeFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!DirectPrizeFlag && record.Id == 0)
|
|
|
+ {
|
|
|
+ function.WriteLog("没发--订单号:" + order.OrderNo + ";发放金额:" + order.BuyCount + "00;", "推荐奖励计算");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ opdb.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|