예제 #1
0
        public void UpdateUserBalance(C_User_Balance entity)
        {
            var maxTime     = 3;
            var currentTime = 0;

            while (currentTime < maxTime)
            {
                try
                {
                    DB.GetDal <C_User_Balance>().Update(entity);
                    break;
                }

                catch (Exception ex)
                {
                    //var writer = Common.Log.LogWriterGetter.GetLogWriter();
                    //writer.Write("ERROR_UserBalanceManager", "_UpdateUserBalance", Common.Log.LogType.Error, "更新用户资金问题出错", ex.ToString());
                    //throw new Exception("资金处理错误,请重试", ex);
                }

                currentTime++;
                Thread.Sleep(1000);
            }
        }
예제 #2
0
        public void RegisterUser(SystemUser user, UserRegInfo regInfo)
        {
            DB.Begin();
            var loginBiz = new LocalLoginBusiness();

            var register = new C_User_Register
            {
                DisplayName = regInfo.DisplayName,
                ComeFrom    = regInfo.ComeFrom,
                RegType     = regInfo.RegType,
                RegisterIp  = regInfo.RegisterIp,
                Referrer    = regInfo.Referrer,
                ReferrerUrl = regInfo.ReferrerUrl,
                IsEnable    = true,
                IsAgent     = false,
                IsFillMoney = false,
                AgentId     = regInfo.AgentId,
                CreateTime  = DateTime.Now,
                VipLevel    = 0,
                UserId      = user.UserId,
            };

            try
            {
                if (!string.IsNullOrEmpty(regInfo.AgentId))
                {
                    var agentUser = loginBiz.GetRegisterById(regInfo.AgentId);
                    if (agentUser != null)
                    {
                        register.ParentPath = agentUser.ParentPath + "/" + agentUser.UserId;
                    }
                }
            }
            catch { }

            var AuthUser = new C_Auth_Users
            {
                UserId     = user.UserId,
                RegFrom    = user.RegFrom,
                AgentId    = regInfo.AgentId,
                CreateTime = DateTime.Now,
            };

            DB.GetDal <C_User_Register>().Add(register);
            DB.GetDal <C_Auth_Users>().Add(AuthUser);

            var balance = new C_User_Balance
            {
                BonusBalance      = 0M,
                FreezeBalance     = 0M,
                CommissionBalance = 0M,
                ExpertsBalance    = 0M,
                FillMoneyBalance  = 0M,
                RedBagBalance     = 0M,
                CurrentDouDou     = 0,
                UserGrowth        = 0,
                IsSetPwd          = false,
                NeedPwdPlace      = string.Empty,
                Password          = string.Empty,
                UserId            = user.UserId,
                Version           = 0,
                AgentId           = regInfo.AgentId,
            };

            DB.GetDal <C_User_Balance>().Add(balance);

            DB.Commit();
        }