|
@@ -798,43 +798,46 @@ namespace MySystem
|
|
|
if(user != null)
|
|
|
{
|
|
|
decimal TotalPrice = 10000;
|
|
|
- if((user.LeaderLevel == 2) && level > 1)
|
|
|
+ if((user.LeaderLevel == 2 || user.UserType == 1) && level > 1)
|
|
|
{
|
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId);
|
|
|
- if(account != null)
|
|
|
+ if(user.LeaderLevel == 2 && result)
|
|
|
{
|
|
|
- if(account.LeaderReserve >= TotalPrice)
|
|
|
+ UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId);
|
|
|
+ if(account != null)
|
|
|
{
|
|
|
- OpReserve(db, order, LeaderUserId, TotalPrice, 2, 0, "推荐小盟主");
|
|
|
- OpLeaderAccount(db, order, LeaderUserId, TotalPrice, 1, 1);
|
|
|
- LeaderUserId = 0;
|
|
|
- result = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LeaderUserId = user.ParentUserId;
|
|
|
- // decimal LeaderReserve = account.LeaderReserve;
|
|
|
- // OpReserve(db, order, LeaderUserId, LeaderReserve, 2, 0, "推荐小盟主");
|
|
|
- // OpLeaderAccount(db, order, LeaderUserId, LeaderReserve);
|
|
|
+ if(account.LeaderReserve >= TotalPrice)
|
|
|
+ {
|
|
|
+ OpReserve(db, order, LeaderUserId, TotalPrice, 2, 0, "推荐小盟主");
|
|
|
+ OpLeaderAccount(db, order, LeaderUserId, TotalPrice, 1, 1);
|
|
|
+ LeaderUserId = 0;
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LeaderUserId = user.ParentUserId;
|
|
|
+ // decimal LeaderReserve = account.LeaderReserve;
|
|
|
+ // OpReserve(db, order, LeaderUserId, LeaderReserve, 2, 0, "推荐小盟主");
|
|
|
+ // OpLeaderAccount(db, order, LeaderUserId, LeaderReserve);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else if(user.UserType == 1 && level > 1)
|
|
|
- {
|
|
|
- OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
|
|
|
- OpModels.UserAccount account = opdb.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId) ?? new OpModels.UserAccount();
|
|
|
- if(account.TotalAmt > 0)
|
|
|
+ if(user.UserType == 1 && result)
|
|
|
{
|
|
|
- if(account.TotalAmt < TotalPrice)
|
|
|
- {
|
|
|
- TotalPrice = account.TotalAmt;
|
|
|
- }
|
|
|
- if(TotalPrice > 0)
|
|
|
+ OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
|
|
|
+ OpModels.UserAccount account = opdb.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId) ?? new OpModels.UserAccount();
|
|
|
+ if(account.TotalAmt > 0)
|
|
|
{
|
|
|
- OperateAmountChange(opdb, LeaderUserId, TotalPrice, 2, 1, "商城购机");
|
|
|
- OperateAmountChange(opdb, LeaderUserId, TotalPrice, 1, 2, "商城购机");
|
|
|
- LeaderUserId = 0;
|
|
|
- result = false;
|
|
|
+ if(account.TotalAmt < TotalPrice)
|
|
|
+ {
|
|
|
+ TotalPrice = account.TotalAmt;
|
|
|
+ }
|
|
|
+ if(TotalPrice > 0)
|
|
|
+ {
|
|
|
+ OperateAmountChange(opdb, LeaderUserId, TotalPrice, 2, 1, "商城购机");
|
|
|
+ OperateAmountChange(opdb, LeaderUserId, TotalPrice, 1, 2, "商城购机");
|
|
|
+ LeaderUserId = 0;
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|