|
@@ -148,8 +148,18 @@ namespace MySystem
|
|
}
|
|
}
|
|
if(Kind <= 2 && pro.ProductId == 10 || pro.ProductId == 11)
|
|
if(Kind <= 2 && pro.ProductId == 10 || pro.ProductId == 11)
|
|
{
|
|
{
|
|
|
|
+ // 购买600一组机具券,返券
|
|
|
|
+ int CouponCount = 0;
|
|
|
|
+ if(Kind == 1)
|
|
|
|
+ {
|
|
|
|
+ CouponCount = 3;
|
|
|
|
+ }
|
|
|
|
+ else if(Kind == 2)
|
|
|
|
+ {
|
|
|
|
+ CouponCount = 2;
|
|
|
|
+ }
|
|
string Codes = "";
|
|
string Codes = "";
|
|
- var coupons = db.PosCoupons.Where(m => m.IsLock == 0 && m.IsUse == 0 && m.UserId == 0 && m.QueryCount == Kind).OrderBy(m => m.Id).Take(BuyCount).ToList();
|
|
|
|
|
|
+ var coupons = db.PosCoupons.Where(m => m.IsLock == 0 && m.IsUse == 0 && m.UserId == 0 && m.QueryCount == Kind).OrderBy(m => m.Id).Take(CouponCount).ToList();
|
|
foreach (var coupon in coupons)
|
|
foreach (var coupon in coupons)
|
|
{
|
|
{
|
|
PosCoupons item = db.PosCoupons.FirstOrDefault(m => m.Id == coupon.Id);
|
|
PosCoupons item = db.PosCoupons.FirstOrDefault(m => m.Id == coupon.Id);
|
|
@@ -213,7 +223,9 @@ namespace MySystem
|
|
db.SaveChanges();
|
|
db.SaveChanges();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- bool directPrize = false;
|
|
|
|
|
|
+ bool directPrize = false; //直推奖标记
|
|
|
|
+ bool bigLeaderPrize = false; //大盟主券标记
|
|
|
|
+ bool buyPrize = false; //返600盟主备用标记
|
|
int ParentUserId = user.ParentUserId;
|
|
int ParentUserId = user.ParentUserId;
|
|
while(ParentUserId > 0)
|
|
while(ParentUserId > 0)
|
|
{
|
|
{
|
|
@@ -245,7 +257,7 @@ namespace MySystem
|
|
if(puser.LeaderLevel > 0)
|
|
if(puser.LeaderLevel > 0)
|
|
{
|
|
{
|
|
UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id) ?? new UserAccount();
|
|
UserAccount acccount = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id) ?? new UserAccount();
|
|
- if(acccount.LeaderReserve >= order.TotalPrice)
|
|
|
|
|
|
+ if(acccount.LeaderReserve >= order.TotalPrice && !buyPrize)
|
|
{
|
|
{
|
|
//扣减备用金
|
|
//扣减备用金
|
|
OpReserve(db, order, puser.Id, order.TotalPrice, 0, order.UserId, "购机奖励");
|
|
OpReserve(db, order, puser.Id, order.TotalPrice, 0, order.UserId, "购机奖励");
|
|
@@ -253,9 +265,10 @@ namespace MySystem
|
|
OpAccount(db, order, puser.Id, order.TotalPrice);
|
|
OpAccount(db, order, puser.Id, order.TotalPrice);
|
|
//购机奖励
|
|
//购机奖励
|
|
OpAccount(db, order, puser.Id, 100);
|
|
OpAccount(db, order, puser.Id, 100);
|
|
|
|
+ buyPrize = true;
|
|
}
|
|
}
|
|
//如果是大盟主,则标记大盟主标签
|
|
//如果是大盟主,则标记大盟主标签
|
|
- if(couponIds.Count > 0 && puser.LeaderLevel == 2)
|
|
|
|
|
|
+ if(couponIds.Count > 0 && puser.LeaderLevel == 2 && !bigLeaderPrize)
|
|
{
|
|
{
|
|
foreach(int couponId in couponIds)
|
|
foreach(int couponId in couponIds)
|
|
{
|
|
{
|
|
@@ -266,6 +279,7 @@ namespace MySystem
|
|
}
|
|
}
|
|
}
|
|
}
|
|
db.SaveChanges();
|
|
db.SaveChanges();
|
|
|
|
+ bigLeaderPrize = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ParentUserId = puser.ParentUserId;
|
|
ParentUserId = puser.ParentUserId;
|