public async Task <ActionResult> Check(Guid?id)
        {
            ResponseModel response = new ResponseModel();
            Deposit       model    = depositService.GetById(id.Value);
            //1.入金mt4金额
            //2.修改account的金额
            //3.修改审核状态
            double amount = Math.Round(model.USDAmount, 2);
            bool   flg    = await mt4Service.ModifyBalance(model.Account.MT4Account, amount);

            if (flg)
            {
                Account account = accountService.GetById(model.AccountId);
                account.Amount += amount;
                model.IsAudit   = true;
                accountService.Update(account);
                depositService.Update(model);
                unitOfWork.Commit();
                response.Msg         = "成功审核入金申请!";
                response.Success     = true;
                response.RedirectUrl = RedirectUrl;
            }
            else
            {
                response.Msg     = "链接交易服务器失败!请重试...";
                response.Success = false;
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public async Task <ActionResult> Check(Guid?id)
        {
            ResponseModel response = new ResponseModel();
            Withdrawals   model    = withdrawalService.GetById(id.Value);
            Account       account  = model.Account;

            if (model.Amount > account.Amount)
            {
                response.Msg     = "提现金额已超限!";
                response.Success = false;
                return(Json(response, JsonRequestBehavior.AllowGet));
            }

            //1.入金mt4金额
            //2.修改account的金额
            //3.修改审核状态
            bool flg = await mt4Service.ModifyBalance(model.Account.MT4Account, model.Amount * -1);

            if (flg)
            {
                account.Amount -= model.Amount;
                model.IsAudit   = true;
                accountService.Update(account);
                withdrawalService.Update(model);
                unitOfWork.Commit();
                response.Msg         = "成功审核提现申请!";
                response.Success     = true;
                response.RedirectUrl = RedirectUrl;
            }
            else
            {
                response.Msg     = "链接交易服务器失败!请重试...";
                response.Success = false;
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }