|
@@ -172,6 +172,65 @@ namespace MySystem
|
|
|
opdb.Dispose();
|
|
|
}
|
|
|
|
|
|
+ public void addprize(int Id)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
|
|
|
+ var query = db.LeaderReserveRecord.FirstOrDefault(m => m.Id == Id && m.Remark == "兑换机具券");
|
|
|
+ if(query != null)
|
|
|
+ {
|
|
|
+ JsonData ApplyList = JsonMapper.ToObject(query.SeoTitle);
|
|
|
+ UserRankItem orderUser = PosCouponPrizeService.Instance.GetUserLevel(query.UserId);
|
|
|
+ string ParentNav = orderUser.ParentNav + "," + orderUser.Id + ",";
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ Array.Reverse(ParentNavList);
|
|
|
+ int index = 0;
|
|
|
+ bool BigLeaderFlag = false; //大盟主标记
|
|
|
+ decimal BuyPrize = 0; //购机奖励
|
|
|
+ foreach(string ParentId in ParentNavList)
|
|
|
+ {
|
|
|
+ UserRankItem parentUser = PosCouponPrizeService.Instance.GetUserLevel(int.Parse(ParentId));
|
|
|
+ index += 1;
|
|
|
+
|
|
|
+ if(parentUser.OperateLevel > 0)
|
|
|
+ {
|
|
|
+ int groupCount = 0;
|
|
|
+ for (int i = 0; i < ApplyList.Count; i++)
|
|
|
+ {
|
|
|
+ int num = Convert.ToInt32(ApplyList[i]["Num"].ToString());
|
|
|
+ int Kind = Convert.ToInt32(ApplyList[i]["Type"].ToString());
|
|
|
+ if(Kind == 1)
|
|
|
+ {
|
|
|
+ groupCount += num / 3;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ groupCount += num / 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(PosCouponPrizeService.Instance.CheckOpReserve(opdb, groupCount, parentUser.Id))
|
|
|
+ {
|
|
|
+ //购机奖
|
|
|
+ decimal CurBuyPrize = GetBuyPrize(parentUser);
|
|
|
+ decimal GetPrize = CurBuyPrize - BuyPrize;
|
|
|
+ int Kind = 0;
|
|
|
+ if(query.Remark == "兑换机具券")
|
|
|
+ {
|
|
|
+ Kind = 101;
|
|
|
+ }
|
|
|
+ if(GetPrize > 0 && !db.UserAccountRecord.Any(m => m.QueryCount == Id && m.ChangeType == 128))
|
|
|
+ {
|
|
|
+ PosCouponPrizeService.Instance.OpAccount(db, Id, parentUser.Id, GetPrize, groupCount, 128, Kind);
|
|
|
+ }
|
|
|
+ BuyPrize = CurBuyPrize;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ opdb.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取购机奖金额
|
|
|
/// </summary>
|