/// <summary> /// /// </summary> /// <param name="userDto"></param> /// <returns></returns> public async Task CreateUserAsync(CreateUserDto userDto) { Check.NotNull(userDto, nameof(userDto)); var anyUserPhone = _userRepository .GetExpression(e => e.PhoneNum == userDto.PhoneNum) .AsNoTracking() .Any(); if (anyUserPhone) { throw new WsBaseException("已经存在的手机号"); } var userModel = _userRepository.MapTo(userDto); userModel.PasswordSalt = StrHelper.CreateStr(6); userModel.Password = _encryptions.CreateMd5(userDto.Password + userModel.PasswordSalt); var createResult = await _userRepository.CreateAsync(userModel); }