|
@@ -97,7 +97,6 @@ namespace MySystem
|
|
|
bool DirectPrizeFlag = false; //推荐奖励发放标识
|
|
|
bool BackAccountFlag = false; //备用金返余额标识
|
|
|
bool BigLeaderFlag = false; //大盟主标记
|
|
|
- BigLeaderFlag = CheckPosCouponLeaderFlag(db, order.UserId, order.BuyCount, codes);
|
|
|
decimal BuyPrize = 0; //购机奖励
|
|
|
foreach(string ParentId in ParentNavList)
|
|
|
{
|
|
@@ -157,7 +156,11 @@ namespace MySystem
|
|
|
}
|
|
|
|
|
|
//给券打大盟主标记
|
|
|
- if(parentUser.LeaderLevel == 2 && !BigLeaderFlag)
|
|
|
+ if(parentUser.LeaderLevel == 1 && CheckLeaderReserve(db, order.BuyCount, parentUser.Id) && !BigLeaderFlag)
|
|
|
+ {
|
|
|
+ BigLeaderFlag = CheckPosCouponLeaderFlag(db, parentUser.Id, order.BuyCount, codes);
|
|
|
+ }
|
|
|
+ else if(parentUser.LeaderLevel == 2 && !BigLeaderFlag)
|
|
|
{
|
|
|
BigLeaderFlag = true;
|
|
|
if(!string.IsNullOrEmpty(order.SnNos))
|
|
@@ -815,23 +818,9 @@ namespace MySystem
|
|
|
public bool CheckPosCouponLeaderFlag(WebCMSEntities db, int UserId, int Count, List<string> codes)
|
|
|
{
|
|
|
int SetCount = 0;
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
- string ParentNav = user.ParentNav + "," + UserId + ",";
|
|
|
- int SmallLeaderUserId = 0;
|
|
|
- string[] ParentNavList = ParentNav.Replace(",,", ",").Trim(',').Split(',');
|
|
|
- Array.Reverse(ParentNavList);
|
|
|
- foreach(string SubId in ParentNavList)
|
|
|
- {
|
|
|
- int ParentUserId = int.Parse(SubId);
|
|
|
- Users puser = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
|
|
|
- if(puser.LeaderLevel == 1)
|
|
|
- {
|
|
|
- SmallLeaderUserId = puser.Id;
|
|
|
- }
|
|
|
- }
|
|
|
decimal CheckReserve = 400 * Count;
|
|
|
decimal LeaderReserve = 0;
|
|
|
- LeaderReserveRecord ReserveRecord = db.LeaderReserveRecord.FirstOrDefault(m => m.SourceUserId == SmallLeaderUserId && m.Remark == "推荐小盟主" && m.ChangeAmt - m.UsedReserve > 0);
|
|
|
+ LeaderReserveRecord ReserveRecord = db.LeaderReserveRecord.FirstOrDefault(m => m.SourceUserId == UserId && m.Remark == "推荐小盟主" && m.ChangeAmt - m.UsedReserve > 0);
|
|
|
if(ReserveRecord != null)
|
|
|
{
|
|
|
int LeaderUserId = ReserveRecord.UserId;
|