public IActionResult OnPostTransferAmount()
        {
            ResultNormal result = new ResultNormal();

            try
            {
                var us = base.GetUserSession(false);
                if (us != null)
                {
                    var ac = _UserSrv.GetUserAccount(us.OpenId);
                    if (ac.RemainRewards > 0)
                    {
                        var r = _AliPaySrv.TransferAmount(ac.AliPayAccount, ac.UserOpenId, ac.RemainRewards);
                        if (!r.IsError)
                        {
                            _SalesSrv.CreateTransfer(ac.RemainRewards, ac.UserOpenId, r.OutBizNo, false);
                            ac.RemainRewards = 0;
                            _SalesSrv.SaveChanges();
                        }
                        else
                        {
                            result.ErrorMsg = r.Msg;
                        }
                    }
                    else
                    {
                        result.IntMsg   = -2;
                        result.ErrorMsg = "余额不足不能提取!";
                    }
                }
                else
                {
                    result.IntMsg   = -1;
                    result.ErrorMsg = "需要您重新登录!";
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = "没有获取数据";
                NLogHelper.ErrorTxt(ex.Message);
            }
            return(new JsonResult(result));
        }
Exemplo n.º 2
0
 public AlipayFundTransToaccountTransferResponse TransferAmount(string toUserAliPayAccount, string userOpenId, double amount)
 {
     return(_AliPaySrv.TransferAmount(toUserAliPayAccount, userOpenId, amount));
 }