コード例 #1
0
        public string RegisterResponseMobile(string userId, string mobile, int delaySeconds, string delayDescription)
        {
            try
            {
                DB.Begin();

                TaskList(userId);

                var manager = new UserMobileManager();
                var entity  = manager.GetUserMobile(userId);
                if (entity != null)
                {
                    if (entity.IsSettedMobile)
                    {
                        throw new LogicException(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 LogicException(string.Format("提交认证手机必须在请求认证后【{0}】内完成。", delayDescription));
                    }
                    entity.IsSettedMobile = true;
                    manager.UpdateUserMobile(entity);
                }
                else
                {
                    entity = new E_Authentication_Mobile
                    {
                        UserId         = userId,
                        CreateTime     = DateTime.Now,
                        UpdateTime     = DateTime.Now,
                        AuthFrom       = "LOCAL",
                        Mobile         = mobile,
                        IsSettedMobile = true,
                        CreateBy       = userId,
                        UpdateBy       = userId,
                    };
                    manager.AddUserMobile(entity);
                }

                mobile = entity.Mobile;

                DB.Commit();
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }


            return(mobile);
        }
コード例 #2
0
 public void AddUserMobile(E_Authentication_Mobile entity)
 {
     DB.GetDal <E_Authentication_Mobile>().Add(entity);
 }
コード例 #3
0
 public void UpdateUserMobile(E_Authentication_Mobile entity)
 {
     DB.GetDal <E_Authentication_Mobile>().Update(entity);
 }