public string ResponseAuthenticationMobile(string userId, int delaySeconds, string delayDescription) { string mobile; DB.Begin(); TaskList(userId); var manager = new UserMobileManager(); var entity = manager.GetUserMobile(userId); if (entity == null) { throw new ArgumentException("尚未请求手机认证"); } if (entity.IsSettedMobile) { 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.IsSettedMobile = true; manager.UpdateUserMobile(entity); mobile = entity.Mobile; DB.Commit(); return(mobile); }
public string RegisterResponseMobile(string userId, string mobile, int delaySeconds, string delayDescription) { DB.Begin(); TaskList(userId); var manager = new UserMobileManager(); var entity = manager.GetUserMobile(userId); if (entity != null) { if (entity.IsSettedMobile) { 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.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(); return(mobile); }