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, }); }