Beispiel #1
0
        public void UpdateAuthenticationEmail(string authFrom, string userId, string email, string updateBy)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new BettingPointManager())
                {
                    var entity    = manager.GetUserEmail(userId);
                    var emailInfo = manager.GetEmailInfoByEmail(email);
                    if (entity == null)
                    {
                        throw new ArgumentException("此用户从未进行过实名认证");
                    }
                    if (emailInfo != null && emailInfo.UserId != userId)
                    {
                        if (!string.IsNullOrEmpty(emailInfo.Email) && emailInfo.IsSettedEmail)
                        {
                            throw new Exception("当前邮箱已被他人占用!");
                        }
                    }
                    entity.AuthFrom      = authFrom;
                    entity.Email         = email;
                    entity.UpdateBy      = updateBy;
                    entity.IsSettedEmail = true;

                    manager.UpdateUserEmail(entity);
                }
                biz.CommitTran();
            }
        }
Beispiel #2
0
 public UserEmail GetAuthenticatedEmail(string userId)
 {
     using (var manager = new BettingPointManager())
     {
         var Email = manager.GetUserEmail(userId);
         return(Email);
     }
 }
Beispiel #3
0
        public void AddAuthenticationEmail(string authFrom, string userId, string email, string createBy)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new BettingPointManager())
                {
                    var entity = manager.GetUserEmail(userId);
                    if (entity != null)
                    {
                        throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过邮箱认证", entity.CreateTime));
                    }
                    entity = new UserEmail
                    {
                        UserId        = userId,
                        User          = manager.LoadUser(userId),
                        AuthFrom      = authFrom,
                        Email         = email,
                        IsSettedEmail = true,
                        CreateBy      = createBy,
                        UpdateBy      = createBy,
                    };
                    manager.AddUserEmail(entity);

                    var gv = new TaskListManager();
                    //增加成长值
                    var orderId = Guid.NewGuid().ToString("N");
                    BusinessHelper.Payin_UserGrowth("绑定邮箱", orderId, userId, 50, "完成邮箱绑定可获得50点成长值");
                    gv.AddUserTaskRecord(new UserTaskRecord
                    {
                        CreateTime   = DateTime.Now,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        OrderId      = orderId,
                        TaskCategory = TaskCategory.EmailBinding,
                        TaskName     = "绑定邮箱",
                        UserId       = userId,
                    });
                    gv.AddTaskList(new TaskList
                    {
                        UserId       = userId,
                        OrderId      = orderId,
                        Content      = "完成邮箱绑定可获得50点成长值",
                        ValueGrowth  = 50,
                        IsGive       = true,
                        VipLevel     = 0,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        TaskCategory = TaskCategory.EmailBinding,
                        TaskName     = "绑定邮箱",
                        CreateTime   = DateTime.Now,
                    });
                }
                biz.CommitTran();
            }
        }
Beispiel #4
0
        public void CancelAuthenticationEmail(string userId)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new BettingPointManager())
                {
                    var entity = manager.GetUserEmail(userId);
                    if (entity == null)
                    {
                        throw new ArgumentException("此用户从未进行过实名认证");
                    }
                    entity.IsSettedEmail = false;

                    manager.UpdateUserEmail(entity);
                }
                biz.CommitTran();
            }
        }
Beispiel #5
0
 public UserEmailInfo QueryEmailByUserId(string userId)
 {
     using (var manager = new BettingPointManager())
     {
         UserEmailInfo info   = new UserEmailInfo();
         var           entity = manager.GetUserEmail(userId);
         if (entity == null)
         {
             return(info);
         }
         info.AuthFrom      = entity.AuthFrom;
         info.CreateBy      = entity.CreateBy;
         info.CreateTime    = entity.CreateTime;
         info.Email         = entity.Email;
         info.IsSettedEmail = entity.IsSettedEmail;
         info.RequestTimes  = entity.RequestTimes;
         info.UserId        = entity.UserId;
         return(info);
     }
 }
Beispiel #6
0
 public void ManualSetUserEmail(string userId, string email, string updateBy)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new BettingPointManager())
         {
             var entity = manager.GetUserEmail(userId);
             if (entity == null)
             {
                 throw new ArgumentException("此用户从未进行过邮箱认证");
             }
             entity.IsSettedEmail = true;
             entity.Email         = email;
             entity.UpdateBy      = updateBy;
             entity.UpdateTime    = DateTime.Now;
             manager.UpdateUserEmail(entity);
         }
         biz.CommitTran();
     }
 }
Beispiel #7
0
        public LoginInfo ResponseAuthenticationEmail(string userId, int delaySeconds, string delayDescription, out string mobile)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new BettingPointManager())
                {
                    var entity = manager.GetUserEmail(userId);
                    if (entity == null)
                    {
                        throw new ArgumentException("尚未请求邮箱认证");
                    }
                    if (entity.IsSettedEmail)
                    {
                        throw new ArgumentException(string.Format("已于【{0:yyyy-MM-dd HH:mm:ss}】进行过邮箱认证。", entity.UpdateTime));
                    }
                    var span = DateTime.Now - entity.UpdateTime.AddSeconds(delaySeconds);
                    if (span.TotalSeconds > 0)
                    {
                        throw new ArgumentException(string.Format("提交认证邮箱必须在请求认证后【{0}】内完成。", delayDescription));
                    }
                    entity.IsSettedEmail = true;
                    manager.UpdateUserEmail(entity);
                    mobile = entity.Email;

                    //查询vip等级
                    var balanceManager = new UserBalanceManager();
                    var userReg        = balanceManager.QueryUserRegister(userId);
                    var gv             = new TaskListManager();
                    var old            = gv.QueryTaskListByCategory(userId, TaskCategory.EmailBinding);
                    if (old == null)
                    {
                        //增加成长值
                        var orderId = Guid.NewGuid().ToString("N");
                        BusinessHelper.Payin_UserGrowth("邮箱绑定", orderId, userId, 50, "完成邮箱绑定可获得50点成长值");
                        gv.AddUserTaskRecord(new UserTaskRecord
                        {
                            CreateTime   = DateTime.Now,
                            CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                            OrderId      = orderId,
                            TaskCategory = TaskCategory.EmailBinding,
                            TaskName     = "邮箱绑定",
                            UserId       = userId,
                        });
                        gv.AddTaskList(new TaskList
                        {
                            UserId       = userId,
                            OrderId      = orderId,
                            Content      = "完成邮箱绑定可获得50点成长值",
                            ValueGrowth  = 50,
                            IsGive       = true,
                            VipLevel     = 0,
                            CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                            TaskCategory = TaskCategory.EmailBinding,
                            TaskName     = "邮箱绑定",
                            CreateTime   = DateTime.Now,
                        });
                    }
                }
                biz.CommitTran();
            }
            var authBiz   = new GameBizAuthBusiness();
            var userToken = authBiz.GetUserToken(userId);

            var userManager = new UserBalanceManager();
            var user        = userManager.GetUserRegister(userId);

            return(new LoginInfo
            {
                DisplayName = user.DisplayName,
                LoginFrom = user.ComeFrom,
                UserId = userId,
                Message = "登录成功",
                Referrer = user.Referrer,
                RegType = user.RegType,
                IsSuccess = true,
                UserToken = userToken,
            });
        }