| | |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.Extensions.Configuration; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using Volo.Abp; |
| | |
| | | private readonly IConfiguration _configuration; |
| | | private readonly IIdentityModelAuthenticationService _authenticator; |
| | | private readonly IRepository<User, Guid> _userRepository; |
| | | private readonly IRepository<UserChannle, Guid> _userChannleRep; |
| | | private readonly IIdentityUserAppService _identityUserService; |
| | | |
| | | public AccountService( |
| | |
| | | IIdentityModelAuthenticationService authenticator, |
| | | IRepository<User, Guid> userRepository, |
| | | IIdentityUserAppService identityUserService, |
| | | IRepository<LifePayUser, Guid> lifePayUserRepository) |
| | | IRepository<LifePayUser, Guid> lifePayUserRepository, |
| | | IRepository<UserChannle, Guid> userChannleRep) |
| | | { |
| | | _configuration = configuration; |
| | | _wxManager = wxManager; |
| | |
| | | _lifePayUserRepository = lifePayUserRepository; |
| | | _authenticator = authenticator; |
| | | _userRepository = userRepository; |
| | | _userChannleRep = userChannleRep; |
| | | } |
| | | |
| | | #region 查询 |
| | |
| | | return result; |
| | | } |
| | | |
| | | public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false, string password = null) |
| | | public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false) |
| | | { |
| | | if (input.ClientId == LifePaymentConstant.ClientId.Back) |
| | | { |
| | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(any, |
| | | CustomeErrorMessage.PhoneNumberRepeatSaveFail); |
| | | |
| | | password ??= GlobalRandom.GetRandomPassword(); |
| | | /// input.Password ??= GlobalRandom.GetRandomPassword(); |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password), |
| | | "请输入密码"); |
| | | var res = await _identityUserService.CreateAsync(new IdentityUserCreateDto |
| | | { |
| | | Name = input.Name, |
| | |
| | | UserName = input.UserName, |
| | | RoleNames = input.RoleNames, |
| | | ClientId = input.ClientId, |
| | | Password = password, |
| | | Password = input.Password, |
| | | }); |
| | | var user = await _userRepository.InsertAsync(new User |
| | | { |
| | |
| | | DepartmentOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.DepartmentOrgId : null, |
| | | CompanyOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.CompanyOrgId : null |
| | | }); |
| | | |
| | | List<UserChannle> userChannles = new List<UserChannle>(); |
| | | foreach (var item in input.ChannlesId) |
| | | { |
| | | userChannles.Add(new UserChannle() |
| | | { |
| | | Id = Guid.NewGuid(), |
| | | ChannleId = item, |
| | | UserId = user.Id |
| | | }); |
| | | } |
| | | |
| | | await _userChannleRep.InsertManyAsync(userChannles); |
| | | //if (input.ClientId == Constant.ClientType.Back) |
| | | //{ |
| | | // await _distributedEventBus.PublishAsync(new SendPhoneMessageInput |