Пример #1
0
        public string ResetUserBalancePwd(string userId)
        {
            var newPwd = string.Empty;

            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new UserMobileManager();
                //var entity = manager.GetUserMobile(userId);
                //if (entity == null)
                //    throw new ArgumentException("此用户从未进行过手机认证");
                //if (entity.Mobile != mobileNumber)
                //    throw new ArgumentException("用户认证的手机号码不正确");

                var balanceManager = new UserBalanceManager();
                var balance        = balanceManager.QueryUserBalance(userId);
                if (balance == null)
                {
                    throw new ArgumentException("用户资金信息查询出错");
                }

                balance.Password = Encipherment.MD5(string.Format("{0}{1}", C_DefaultPassword, _gbKey)).ToUpper();
                balanceManager.UpdateUserBalance(balance);

                biz.CommitTran();
            }
            return(newPwd);
        }
Пример #2
0
        public string ChangePassword(string userId)
        {
            var r                      = new Random(DateTime.Now.Millisecond);
            var password               = r.Next(100000, 999999).ToString();
            var encodePassword         = Encipherment.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();
            var password_balance       = r.Next(100000, 999999).ToString();
            var encodePassword_balance = Encipherment.MD5(string.Format("{0}{1}", password_balance, _gbKey)).ToUpper();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                var loginManager = new LoginLocalManager();
                var user         = loginManager.GetLoginByUserId(userId);
                if (user == null)
                {
                    throw new AuthException("用户不存在或不是本地注册用户,不能修改密码。请确定是否是通过支付宝或QQ帐号进行登录,如有疑问,请联系客服。");
                }
                user.Password = encodePassword;
                loginManager.UpdateLogin(user);

                var balanceManage = new UserBalanceManager();
                var b             = balanceManage.QueryUserBalance(userId);
                b.Password = encodePassword_balance;
                balanceManage.UpdateUserBalance(b);

                biz.CommitTran();
            }
            return(string.Format("{0}|{1}", password, password_balance));
        }
Пример #3
0
 public bool?CheckIsSame2BalancePassword(string userId, string newPassword)
 {
     using (var balanceManager = new UserBalanceManager())
     {
         var balance = balanceManager.QueryUserBalance(userId);
         if (balance == null)
         {
             return(null);
         }
         return(balance.Password.Equals(Encipherment.MD5(newPassword)));
     }
 }
Пример #4
0
        public void SetBalancePassword(string userId, string oldPassword, bool isSetPwd, string newPassword)
        {
            var balanceManager = new UserBalanceManager();
            var entity         = balanceManager.QueryUserBalance(userId);

            if (entity.IsSetPwd)
            {
                oldPassword = Encipherment.MD5(string.Format("{0}{1}", oldPassword, _gbKey)).ToUpper();
                if (string.IsNullOrEmpty(oldPassword) || !oldPassword.Equals(entity.Password))
                {
                    throw new Exception("输入资金密码错误");
                }
            }
            entity.IsSetPwd = isSetPwd;
            entity.Password = Encipherment.MD5(string.Format("{0}{1}", newPassword, _gbKey)).ToUpper();
            balanceManager.UpdateUserBalance(entity);
        }
Пример #5
0
        public void AdminResetUserBalancePwd(string userId, string pwd)
        {
            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var balanceManager = new UserBalanceManager();
                var balance        = balanceManager.QueryUserBalance(userId);
                if (balance == null)
                {
                    throw new ArgumentException("用户资金信息查询出错");
                }

                balance.Password = Encipherment.MD5(pwd);
                balanceManager.UpdateUserBalance(balance);

                biz.CommitTran();
            }
        }
Пример #6
0
        public void SetBalancePasswordNeedPlace(string userId, string password, string placeList)
        {
            var balanceManager = new UserBalanceManager();
            var entity         = balanceManager.QueryUserBalance(userId);

            if (entity.IsSetPwd)
            {
                password = Encipherment.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();
                if (string.IsNullOrEmpty(password) || !password.Equals(entity.Password))
                {
                    throw new Exception("输入资金密码错误");
                }
            }
            else
            {
                throw new Exception("必须先设置资金密码");
            }
            entity.NeedPwdPlace = placeList;
            balanceManager.UpdateUserBalance(entity);
        }
Пример #7
0
        public UserQueryInfo QueryUserByUserName(string userName, string agentId)
        {
            var userManager = new UserBalanceManager();
            var reg         = userManager.QueryUserRegisterByUserName(userName);

            if (reg == null)
            {
                throw new Exception("用户不存在");
            }
            if (string.IsNullOrEmpty(reg.AgentId) || reg.AgentId != agentId)
            {
                throw new Exception(string.Format("用户{0}不属于您发展的用户", userName));
            }

            var balance = userManager.QueryUserBalance(reg.UserId);

            if (balance == null)
            {
                throw new Exception("用户账户不存在");
            }

            var realNameManager = new UserRealNameManager();
            var real            = realNameManager.GetUserRealName(reg.UserId);

            var mobileManagr = new UserMobileManager();
            var mobile       = mobileManagr.GetUserMobile(reg.UserId);

            var fundManger         = new FundManager();
            var agentFreezeBalance = fundManger.QueryAgentFreezeBalanceByUserId(reg.UserId);
            var caibbFreezeBalance = 0M;

            if (balance.FreezeBalance > 0)
            {
                caibbFreezeBalance = balance.FreezeBalance - agentFreezeBalance;//网站冻结资金=总冻结资金-代理冻结资金;
            }
            return(new UserQueryInfo
            {
                DisplayName = reg.DisplayName,
                UserId = reg.UserId,
                RealName = real == null ? string.Empty : real.RealName,
                IdCardNumber = real == null ? string.Empty : real.IdCardNumber,
                Mobile = mobile == null ? string.Empty : mobile.Mobile,
                FillMoneyBalance = balance.FillMoneyBalance,
                BonusBalance = balance.BonusBalance,
                CommissionBalance = balance.CommissionBalance,
                ExpertsBalance = balance.ExpertsBalance,
                RedBagBalance = balance.RedBagBalance,
                FreezeBalance = caibbFreezeBalance,
                IsEnable = reg.IsEnable,
                AgentId = reg.AgentId,
                IsAgent = reg.IsAgent,
                CardType = "",
                ComeFrom = reg.ComeFrom,
                Email = "",
                IsFillMoney = reg.IsFillMoney,
                IsSettedEmail = true,
                IsSettedMobile = mobile == null ? false : mobile.IsSettedMobile,
                IsSettedRealName = real == null ? false : real.IsSettedRealName,
                RegisterIp = reg.RegisterIp,
                RegTime = reg.CreateTime,
                VipLevel = reg.VipLevel,
                CurrentDouDou = balance.CurrentDouDou,
            });
        }
Пример #8
0
        public UserQueryInfo QueryUserByKey(string userId, string agentId)
        {
            var userManager = new UserBalanceManager();
            var reg         = userManager.QueryUserRegister(userId);

            if (reg == null)
            {
                throw new Exception("用户不存在");
            }
            if (!string.IsNullOrEmpty(agentId) && reg.AgentId != agentId)
            {
                throw new Exception(string.Format("用户{0}不属于您发展的用户", userId));
            }

            var balance = userManager.QueryUserBalance(userId);

            if (balance == null)
            {
                throw new Exception("用户账户不存在");
            }

            var realNameManager = new UserRealNameManager();
            var real            = realNameManager.GetUserRealName(userId);

            //var apliy = new AlipayLoginInfo();
            //var apliyCount = apliy.ApliyCount;
            var mobileManagr = new UserMobileManager();
            var mobile       = mobileManagr.GetUserMobile(userId);

            var fundManger         = new FundManager();
            var agentFreezeBalance = fundManger.QueryAgentFreezeBalanceByUserId(userId);
            var caibbFreezeBalance = 0M;

            if (balance.FreezeBalance > 0)
            {
                caibbFreezeBalance = balance.FreezeBalance - agentFreezeBalance;//网站冻结资金=总冻结资金-代理冻结资金;
            }
            var userAlipayManager = new UserAlipayManager();
            var userAlipy         = userAlipayManager.GetUserAlipay(userId);


            var userQQManager = new UserQQManager();
            var userQQ        = userQQManager.GetUserQQ(userId);

            var ocAgentManager = new OCAgentManager();
            var ocAgent        = ocAgentManager.QueryOCAgent(userId);

            return(new UserQueryInfo
            {
                DisplayName = reg.DisplayName,
                UserId = reg.UserId,
                RealName = real == null ? string.Empty : real.RealName,
                IdCardNumber = real == null ? string.Empty : real.IdCardNumber,
                Mobile = mobile == null ? string.Empty : mobile.Mobile,
                FillMoneyBalance = balance.FillMoneyBalance,
                BonusBalance = balance.BonusBalance,
                CommissionBalance = balance.CommissionBalance,
                ExpertsBalance = balance.ExpertsBalance,
                RedBagBalance = balance.RedBagBalance,
                FreezeBalance = caibbFreezeBalance,
                IsEnable = reg.IsEnable,
                AgentId = reg.AgentId,
                IsAgent = reg.IsAgent,
                CardType = "",
                ComeFrom = reg.ComeFrom,
                Email = "",
                IsFillMoney = reg.IsFillMoney,
                IsSettedEmail = true,
                IsSettedMobile = mobile == null ? false : mobile.IsSettedMobile,
                IsSettedRealName = real == null ? false : real.IsSettedRealName,
                RegisterIp = reg.RegisterIp,
                RegTime = reg.CreateTime,
                VipLevel = reg.VipLevel,
                CurrentDouDou = balance.CurrentDouDou,
                ApliyCount = userAlipy == null ? string.Empty : userAlipy.AlipayAccount,
                QQNumber = userQQ == null ? string.Empty : userQQ.QQ,
                CPSMode = ocAgent == null ? 0 : ocAgent.CPSMode,
                UserGrowth = balance.UserGrowth,
                CPSBalance = balance.CPSBalance
            });
        }
Пример #9
0
        /// <summary>
        /// 申请提现
        /// 计算申请金额是否可提现,返回计算结果
        /// </summary>
        public CheckWithdrawResult RequestWithdraw_Step1(string userId, decimal requestMoney)
        {
            var balanceManager = new UserBalanceManager();
            var fundManager    = new FundManager();
            var userManager    = new UserManager();
            var maxTimes       = 3;
            var currentTimes   = fundManager.QueryTodayWithdrawTimes(userId);

            if (currentTimes >= maxTimes)
            {
                throw new Exception(string.Format("每日只能提现{0}次", maxTimes));
            }
            var user = userManager.LoadUser(userId);

            if (user == null)
            {
                throw new Exception("用户不存在 - " + userId);
            }
            var userBalance = balanceManager.QueryUserBalance(userId);

            if (userBalance == null)
            {
                throw new Exception("用户帐户不存在 - " + userId);
            }

            //奖金+佣金+名家
            var can_tx_money = userBalance.BonusBalance + userBalance.CommissionBalance + userBalance.ExpertsBalance;

            //正常提现
            if (can_tx_money >= requestMoney)
            {
                return(new CheckWithdrawResult
                {
                    WithdrawCategory = WithdrawCategory.General,
                    RequestMoney = requestMoney,
                    ResponseMoney = requestMoney,
                    Summary = string.Format("申请提现{0:N2}元,到账{0:N2}元。", requestMoney),
                });
            }

            var payoutMoney = requestMoney - can_tx_money;

            if (userBalance.FillMoneyBalance < payoutMoney)
            {
                return(new CheckWithdrawResult
                {
                    WithdrawCategory = WithdrawCategory.Error,
                    RequestMoney = requestMoney,
                    ResponseMoney = 0,
                    Summary = "可用充值金额不足",
                });
            }

            #region  处理充值金额的消费,直接扣5%



            var percent = decimal.Parse(new CacheDataBusiness().QueryCoreConfigFromRedis("WithdrawAboutFillMoney.CutPercent"));
            //收取5%手续费
            var cutFree = payoutMoney * percent / 100;

            return(new CheckWithdrawResult
            {
                RequestMoney = requestMoney,
                ResponseMoney = requestMoney - cutFree,
                WithdrawCategory = WithdrawCategory.Compulsory,
                Summary = string.Format("提现金额中包含充值金额,需要扣除{0}%手续费{1:N2}元,实际到账{2:N2}元", percent, cutFree, requestMoney - cutFree),
            });

            #endregion
        }