/// <summary> /// EP复投 /// </summary> /// <param name="Ep"></param> /// <returns></returns> public JsonResult EPRepeat(string Ep) { bool result = false; decimal EpAmount = 0; int userId = _ServiceContext.SND_CurrentUser.UserId; result = decimal.TryParse(Ep, out EpAmount); if (!result) { return(Json(new { result = result, msg = "请输入正确的EP数量" })); } //验证 if (EpAmount == 0) { return(Json(new { result = false, msg = "请输入正确的EP数量" })); } if (EpAmount % 200 != 0) { return(Json(new { result = false, msg = "EP数量必须为200的倍数!" })); } //验证账户EP余额 AccountInfo account = _accountBll.GetAccByUserId(userId); if (EpAmount > account.Ep) { return(Json(new { result = false, msg = "EP数量不足!" })); } //复投 放大资产 account.Ep -= EpAmount; switch (_ServiceContext.SND_CurrentUser.Level) //不同级别 使用不同杠杆 { case 1: account.TotalAssets += EpAmount * 7; break; case 2: account.TotalAssets += EpAmount * 6; break; case 3: account.TotalAssets += EpAmount * 5; break; case 4: account.TotalAssets += EpAmount * 4; break; case 5: account.TotalAssets += EpAmount * 3; break; default: break; } result = _accountBll.UpdateAccInfo(account); // 添加复投记录 if (result) { // result = _userBll.UpdateUserLevel(userId); LogInfo model = new LogInfo(); model.CreateTime = DateTime.Now; model.LogType = 5; model.Number = EpAmount; model.UserId = userId; result = _logBll.Insert(model); } else { return(Json(new { result = result, msg = "资产扩充失败,请稍后再试!" })); } return(Json(new { result = result, msg = "资产扩充成功!" })); }