|
@@ -212,6 +212,136 @@ namespace MySystem
|
|
|
opdb.Dispose();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public void dosomething2(int OrderId)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
|
|
|
+ Orders order = db.Orders.FirstOrDefault(m => m.Id == OrderId);
|
|
|
+ if(order != null)
|
|
|
+ {
|
|
|
+ List<int> ChkIds = new List<int>(); //机具券商品Id集合
|
|
|
+ ChkIds.Add(10);
|
|
|
+ ChkIds.Add(11);
|
|
|
+ ChkIds.Add(77);
|
|
|
+ ChkIds.Add(78);
|
|
|
+ ChkIds.Add(79);
|
|
|
+ //判断是否是指定商品
|
|
|
+ if(ChkIds.Contains(order.ProductId))
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ UserRankItem orderUser = GetUserLevel(order.UserId);
|
|
|
+ if(orderUser.UserLevel == 0)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ string ParentNav = orderUser.ParentNav + "," + orderUser.Id + ",";
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ Array.Reverse(ParentNavList);
|
|
|
+ int index = 0;
|
|
|
+ bool DirectPrizeFlag = false; //推荐奖励发放标识
|
|
|
+ bool BackAccountFlag = false; //备用金返余额标识
|
|
|
+ bool BigLeaderFlag = false; //大盟主标记
|
|
|
+ decimal BuyPrize = 0; //购机奖励
|
|
|
+ foreach(string ParentId in ParentNavList)
|
|
|
+ {
|
|
|
+ UserRankItem parentUser = GetUserLevel(int.Parse(ParentId));
|
|
|
+ index += 1;
|
|
|
+ if(index == 1 && (orderUser.LeaderLevel > 0 || orderUser.OperateLevel > 0) && !DirectPrizeFlag)
|
|
|
+ {
|
|
|
+ DirectPrizeFlag = true;
|
|
|
+ }
|
|
|
+ if(index > 1)
|
|
|
+ {
|
|
|
+ if(Utils.Instance.IsStandardUser(parentUser.Id) && !DirectPrizeFlag)
|
|
|
+ {
|
|
|
+ DirectPrizeFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(parentUser.AgoLeaderLevel > 0 && CheckLeaderReserve(db, order.BuyCount, parentUser.Id))
|
|
|
+ {
|
|
|
+ //购机奖
|
|
|
+ if(parentUser.LeaderLevel > 0)
|
|
|
+ {
|
|
|
+ decimal CurBuyPrize = GetBuyPrize(parentUser);
|
|
|
+ decimal GetPrize = CurBuyPrize - BuyPrize;
|
|
|
+ if(GetPrize > 0)
|
|
|
+ {
|
|
|
+ bool PrizeFlag = true;
|
|
|
+ int ChangeType = 118;
|
|
|
+ if(parentUser.OperateLevel == 1)
|
|
|
+ {
|
|
|
+ ChangeType = 120;
|
|
|
+ }
|
|
|
+ if(parentUser.OperateLevel > 1)
|
|
|
+ {
|
|
|
+ ChangeType = 128;
|
|
|
+ if(function.CheckNull(RedisDbconn.Instance.Get<string>("YingXunUser")).Contains("," + orderUser.Id + ","))
|
|
|
+ {
|
|
|
+ PrizeFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(PrizeFlag && !db.UserAccountRecord.Any(m => m.QueryCount == order.Id && m.ChangeType == 128) && GetPrize == 60)
|
|
|
+ {
|
|
|
+ OpAccount(db, order.Id, parentUser.Id, GetPrize, order.BuyCount, ChangeType);
|
|
|
+ }
|
|
|
+ BuyPrize = CurBuyPrize;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!BackAccountFlag)
|
|
|
+ {
|
|
|
+ BackAccountFlag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(parentUser.OperateLevel > 0 && CheckOpReserve(opdb, order.BuyCount, parentUser.Id))
|
|
|
+ {
|
|
|
+ //购机奖
|
|
|
+ decimal CurBuyPrize = GetBuyPrize(parentUser);
|
|
|
+ decimal GetPrize = CurBuyPrize - BuyPrize;
|
|
|
+ if(GetPrize > 0)
|
|
|
+ {
|
|
|
+ int ChangeType = 120;
|
|
|
+ if(parentUser.OperateLevel > 1)
|
|
|
+ {
|
|
|
+ ChangeType = 128;
|
|
|
+ }
|
|
|
+ BuyPrize = CurBuyPrize;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!BackAccountFlag)
|
|
|
+ {
|
|
|
+ BackAccountFlag = true;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ opdb.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取创客各种等级
|
|
|
/// </summary>
|