private async Task <bool> DoesMemberExist(MemberToLoginDto memberToLoginDto)
 {
     return(await _memberRepository.AnyAsync(m =>
                                             (!string.IsNullOrEmpty(m.LoginName) &&
                                              !string.IsNullOrEmpty(memberToLoginDto.LoginName) &&
                                              m.LoginName.Equals(memberToLoginDto.LoginName, StringComparison.CurrentCultureIgnoreCase)) ||
                                             (!string.IsNullOrEmpty(m.EmailAddress) &&
                                              !string.IsNullOrEmpty(memberToLoginDto.EmailAddress) &&
                                              m.EmailAddress.Equals(memberToLoginDto.EmailAddress, StringComparison.CurrentCultureIgnoreCase))));
 }
        /// <summary>
        /// 创建会员
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <bool> Handle(CreateMemberCommand request, CancellationToken cancellationToken)
        {
            //验证账号是否存在
            if (await _memberRepository.AnyAsync(p => p.PhoneNumber == request.PhoneNumber))
            {
                throw new WlException("号码已注册");
            }
            //验证手机号是否被添加
            if (await _userRepository.AnyAsync(p => p.PhoneNumber == request.PhoneNumber))
            {
                throw new WlException("此号码已被添加为员工,无法注册.请联系管理员");
            }
            var allowUserNumber = _configuration["Allocation:allowUserNumber"];
            var member          = new Domain.Member(request.UserName, request.PhoneNumber, request.Company, allowUserNumber.ToInt(0).Value);

            member = await _memberRepository.InsertAndGetIdAsync(member);

            //优先创建member表数据,member.id可以获取到
            member.CreateMemberUser(request.Password);
            member.CreateMemberFeatureMenu();
            await _memberRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);

            return(true);
        }