Beispiel #1
0
        public JsonResult ApplyWithDrawSubmit(string openid, string nickname, decimal amount, string pwd)
        {
            var success = Application.MemberApplication.VerificationPayPwd(CurrentUser.Id, pwd);

            if (!success)
            {
                throw new HimallException("支付密码不对,请重新输入!");
            }
            var capitalInfo = _iMemberCapitalService.GetCapitalInfo(CurrentUser.Id);

            if (amount > capitalInfo.Balance)
            {
                throw new HimallException("提现金额不能超出可用金额!");
            }
            if (amount <= 0)
            {
                throw new HimallException("提现金额不能小于等于0!");
            }
            ApplyWithDrawInfo model = new ApplyWithDrawInfo()
            {
                ApplyAmount = amount,
                ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm,
                ApplyTime   = DateTime.Now,
                MemId       = CurrentUser.Id,
                OpenId      = openid,
                NickName    = nickname
            };

            _iMemberCapitalService.AddWithDrawApply(model);
            return(Json(new { success = true }));
        }
Beispiel #2
0
        public JsonResult ApplyWithDrawSubmit(string nickname, decimal amount, string pwd)
        {
            var success = MemberApplication.VerificationPayPwd(CurrentUser.Id, pwd);

            if (!success)
            {
                throw new HimallException("支付密码不对,请重新输入!");
            }
            var capitalInfo = _iMemberCapitalService.GetCapitalInfo(CurrentUser.Id);

            if (amount > capitalInfo.Balance)
            {
                throw new HimallException("提现金额不能超出可用金额!");
            }
            if (amount <= 0)
            {
                throw new HimallException("提现金额不能小于等于0!");
            }
            var    openid  = Core.Helper.WebHelper.GetCookie(CookieKeysCollection.HIMALL_USER_OpenID);
            string strNick = string.Empty;

            if (!string.IsNullOrWhiteSpace(openid))
            {
                openid = Core.Helper.SecureHelper.AESDecrypt(openid, "Mobile");
                var siteSetting = _iSiteSettingService.GetSiteSettings();
                if (!(string.IsNullOrWhiteSpace(siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(siteSetting.WeixinAppSecret)))
                {
                    string token    = AccessTokenContainer.TryGetToken(siteSetting.WeixinAppId, siteSetting.WeixinAppSecret);
                    var    userinfo = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetUserInfo(token, openid);
                    if (userinfo != null)
                    {
                        strNick = userinfo.nickname;
                    }
                }
            }
            else
            {
                throw new HimallException("数据异常,OpenId不能为空!");
            }

            ApplyWithDrawInfo model = new ApplyWithDrawInfo()
            {
                ApplyAmount = amount,
                ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm,
                ApplyTime   = DateTime.Now,
                MemId       = CurrentUser.Id,
                OpenId      = openid,
                NickName    = strNick
            };

            _iMemberCapitalService.AddWithDrawApply(model);
            return(Json(new { success = true }));
        }
        public JsonResult ApplyWithDrawSubmit(string openid, string nickname, decimal amount, string pwd, int applyType = 1)
        {
            var success = Application.MemberApplication.VerificationPayPwd(CurrentUser.Id, pwd);

            if (!success)
            {
                throw new MallException("支付密码不对,请重新输入!");
            }
            if (applyType == CommonModel.UserWithdrawType.ALiPay.GetHashCode() && !SiteSettings.Withdraw_AlipayEnable)
            {
                throw new MallException("不支持支付宝提现方式!");
            }
            //TODO:FG 存在多处申请提现逻辑,提取至Application中实现
            var balance = MemberCapitalApplication.GetBalanceByUserId(CurrentUser.Id);

            if (amount > balance)
            {
                throw new MallException("提现金额不能超出可用金额!");
            }
            if (amount <= 0)
            {
                throw new MallException("提现金额不能小于等于0!");
            }
            if (string.IsNullOrWhiteSpace(openid))
            {
                throw new MallException("数据异常,OpenId或收款账号不可为空!");
            }
            if (string.IsNullOrWhiteSpace(nickname) && applyType == CommonModel.UserWithdrawType.ALiPay.GetHashCode())
            {
                throw new MallException("数据异常,真实姓名不可为空!");
            }
            var siteSetting = SiteSettingApplication.SiteSettings;

            if (!(amount <= siteSetting.WithDrawMaximum) && !(amount >= siteSetting.WithDrawMinimum))
            {
                throw new MallException("提现金额不能小于:" + siteSetting.WithDrawMinimum + ",不能大于:" +
                                        siteSetting.WithDrawMaximum);
            }
            Mall.Entities.ApplyWithdrawInfo model = new Mall.Entities.ApplyWithdrawInfo()
            {
                ApplyAmount = amount,
                ApplyStatus = Mall.Entities.ApplyWithdrawInfo.ApplyWithdrawStatus.WaitConfirm,
                ApplyTime   = DateTime.Now,
                MemId       = CurrentUser.Id,
                OpenId      = openid,
                NickName    = nickname,
                ApplyType   = (CommonModel.UserWithdrawType)applyType
            };
            _iMemberCapitalService.AddWithDrawApply(model);
            return(Json(new { success = true }));
        }
 /// <summary>
 /// 添加提现申请
 /// </summary>
 /// <param name="memid"></param>
 /// <param name="amount"></param>
 /// <param name="nickname"></param>
 public static void AddWithDrawApply(ApplyWithDrawInfo model)
 {
     _iMemberCapitalService.AddWithDrawApply(model);
 }
        public JsonResult ApplyWithDrawSubmit(string openid, string nickname, decimal amount, string pwd, int applyType = 1)
        {
            var success = MemberApplication.VerificationPayPwd(CurrentUser.Id, pwd);

            if (!success)
            {
                throw new HimallException("支付密码不对,请重新输入!");
            }
            if (applyType == CommonModel.UserWithdrawType.ALiPay.GetHashCode() && !SiteSettings.Withdraw_AlipayEnable)
            {
                throw new HimallException("不支持支付宝提现方式!");
            }

            var balance = MemberCapitalApplication.GetBalanceByUserId(UserId);

            if (amount > balance)
            {
                throw new HimallException("提现金额不能超出可用金额!");
            }
            if (amount <= 0)
            {
                throw new HimallException("提现金额不能小于等于0!");
            }
            if (string.IsNullOrWhiteSpace(openid) && applyType == CommonModel.UserWithdrawType.WeiChat.GetHashCode())
            {
                openid = Core.Helper.WebHelper.GetCookie(CookieKeysCollection.HIMALL_USER_OpenID);
            }
            if (string.IsNullOrWhiteSpace(nickname) && applyType == CommonModel.UserWithdrawType.ALiPay.GetHashCode())
            {
                throw new HimallException("数据异常,真实姓名不可为空!");
            }
            if (!string.IsNullOrWhiteSpace(openid) && applyType == CommonModel.UserWithdrawType.WeiChat.GetHashCode())
            {
                openid = Core.Helper.SecureHelper.AESDecrypt(openid, "Mobile");
                var siteSetting = SiteSettingApplication.SiteSettings;
                if (!(string.IsNullOrWhiteSpace(siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(siteSetting.WeixinAppSecret)))
                {
                    string token    = AccessTokenContainer.TryGetToken(siteSetting.WeixinAppId, siteSetting.WeixinAppSecret);
                    var    userinfo = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetUserInfo(token, openid);
                    if (userinfo != null)
                    {
                        nickname = userinfo.nickname;
                    }
                }
            }
            if (string.IsNullOrWhiteSpace(openid))
            {
                throw new HimallException("数据异常,OpenId或收款账号不可为空!");
            }

            Himall.Entities.ApplyWithDrawInfo model = new Himall.Entities.ApplyWithDrawInfo()
            {
                ApplyAmount = amount,
                ApplyStatus = Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm,
                ApplyTime   = DateTime.Now,
                MemId       = CurrentUser.Id,
                OpenId      = openid,
                NickName    = nickname,
                ApplyType   = (CommonModel.UserWithdrawType)applyType
            };
            _iMemberCapitalService.AddWithDrawApply(model);
            return(Json(new { success = true }));
        }