/// <summary>
        /// 提现申请数据提交
        /// </summary>
        /// <returns></returns>
        public JsonResult ApplyWithDrawSubmit(string pluginId, string destination, string code, decimal amount, int WithdrawType)
        {
            int result = MemberApplication.CheckCode(pluginId, code, destination, CurrentUser.Id);

            if (result > 0)
            {
                Himall.DTO.ShopWithDraw model = new ShopWithDraw()
                {
                    SellerId         = CurrentUser.Id,
                    SellerName       = CurrentUser.UserName,
                    ShopId           = CurrentSellerManager.ShopId,
                    WithdrawalAmount = amount,
                    WithdrawType     = (Himall.CommonModel.WithdrawType)WithdrawType
                };

                bool isbool = BillingApplication.ShopApplyWithDraw(model);

                if (isbool)
                {
                    return(Json(new { success = true, msg = "成功!" }));
                }
                else
                {
                    return(Json(new { success = false, msg = "余额不足,无法提现!" }));
                }
            }
            else
            {
                return(Json(new { success = false, msg = "验证码错误!" }));
            }
        }
示例#2
0
        /// <summary>
        /// 提现申请数据提交
        /// </summary>
        /// <returns></returns>
        public object ApplyWithDrawSubmit(ApplyWithDrawSubmitPostModel model)
        {
            CheckShopManageLogin();

            if (!CheckCertificate(model.Certificate))
            {
                return(ErrorResult("凭证无效"));
            }

            Himall.DTO.ShopWithDraw info = new ShopWithDraw()
            {
                SellerId         = CurrentUser.Id,
                SellerName       = CurrentUser.UserName,
                ShopId           = CurrentShop.Id,
                WithdrawalAmount = model.Amount,
                WithdrawType     = WithdrawType.BankCard
            };

            if (model.Amount <= 0)
            {
                return(ErrorResult("提现金额不正确"));
            }

            bool isbool = BillingApplication.ShopApplyWithDraw(info);

            if (isbool)
            {
                return(Json(new { success = true, msg = "成功!" }));
            }
            else
            {
                return(Json(new { success = false, msg = "余额不足,无法提现!" }));
            }
        }
        public object ApplyWithDraw(ApplayWithDrawParam applay)
        {
            long userId  = UserCookieEncryptHelper.Decrypt(applay.userKey, CookieKeysCollection.USERROLE_SELLERADMIN);
            var  manager = ServiceProvider.Instance <IManagerService> .Create.GetSellerManager(userId);

            var shopinfo = ServiceProvider.Instance <IShopService> .Create.GetShop(manager.ShopId);

            Himall.DTO.ShopWithDraw model = new ShopWithDraw()
            {
                SellerId         = manager.Id,
                SellerName       = manager.UserName,
                ShopId           = shopinfo.Id,
                WithdrawalAmount = applay.amount,
                WithdrawType     = (Himall.CommonModel.WithdrawType)applay.withdrawType
            };

            bool isbool = BillingApplication.ShopApplyWithDraw(model);

            if (isbool)
            {
                return(Json(new { success = true, msg = "成功!" }));
            }
            else
            {
                return(Json(new { success = false, msg = "余额不足,无法提现!" }));
            }
        }
        /// <summary>
        /// 商家申请提现
        /// </summary>
        /// <param name="draw">申请提现实体</param>
        /// <returns></returns>
        public static bool ShopApplyWithDraw(ShopWithDraw draw)
        {
            var mAccount = _iBillingService.GetShopAccount(draw.ShopId);

            if (mAccount.Balance >= draw.WithdrawalAmount)
            {
                var    model       = _iShopService.GetShop(draw.ShopId);
                string Account     = "";
                string AccountName = "";
                if (draw.WithdrawType.Equals(WithdrawType.BankCard))
                {
                    Account     = model.BankAccountNumber;
                    AccountName = model.BankAccountName;
                }
                else
                {
                    Account     = model.WeiXinOpenId;
                    AccountName = model.WeiXinTrueName;
                }


                lock (obj)
                {
                    //处理余额
                    var mShopAccountInfo = _iBillingService.GetShopAccount(draw.ShopId);
                    mShopAccountInfo.Balance -= draw.WithdrawalAmount;
                    _iBillingService.UpdateShopAccount(mShopAccountInfo);


                    ShopWithDrawInfo Models = new ShopWithDrawInfo()
                    {
                        Account     = Account,
                        AccountName = AccountName,
                        ApplyTime   = DateTime.Now,
                        CashAmount  = draw.WithdrawalAmount,
                        CashType    = draw.WithdrawType,
                        SellerId    = draw.SellerId,
                        SellerName  = draw.SellerName,
                        ShopId      = draw.ShopId,
                        ShopRemark  = "",
                        Status      = Himall.CommonModel.WithdrawStaus.WatingAudit,
                        ShopName    = model.ShopName,
                        CashNo      = DateTime.Now.ToString("yyyyMMddHHmmssffff")
                    };
                    _iBillingService.AddShopWithDrawInfo(Models);
                }


                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 提现申请数据提交
        /// </summary>
        /// <returns></returns>
        public JsonResult ApplyWithDrawSubmit(string pluginId, string destination, string code, decimal amount, int WithdrawType, string Account, string AccountName)
        {
            long userId = MemberApplication.GetMemberUserIdOrShop(CurrentUser, CurrentSellerManager);
            int  result = MemberApplication.CheckCode(pluginId, code, destination, userId);

            if (result > 0)
            {
                var sitesetting = SiteSettingApplication.SiteSettings;
                if (amount <= sitesetting.ShopWithDrawMinimum && amount >= sitesetting.ShopWithDrawMaximum)
                {
                    return(Json(new { success = false, msg = "提现金额不能小于:" + sitesetting.ShopWithDrawMinimum + " 元,不能大于:" + sitesetting.ShopWithDrawMaximum + " 元" }));
                }
                Himall.DTO.ShopWithDraw model = new ShopWithDraw()
                {
                    SellerId         = userId,
                    SellerName       = CurrentSellerManager.UserName,
                    ShopId           = CurrentSellerManager.ShopId,
                    WithdrawalAmount = amount,
                    WithdrawType     = (Himall.CommonModel.WithdrawType)WithdrawType,
                    Account          = Account,
                    AccountName      = AccountName
                };
                if (model.WithdrawType == CommonModel.WithdrawType.ALipay)
                {
                    if (string.IsNullOrEmpty(model.Account) || string.IsNullOrEmpty(model.AccountName))
                    {
                        return(Json(new { success = false, msg = "支付宝提现请填写支付账号与真实姓名!" }));
                    }
                }

                bool isbool = BillingApplication.ShopApplyWithDraw(model);

                if (isbool)
                {
                    return(Json(new { success = true, msg = "成功!" }));
                }
                else
                {
                    return(Json(new { success = false, msg = "余额不足,无法提现!" }));
                }
            }
            else
            {
                return(Json(new { success = false, msg = "验证码错误!" }));
            }
        }