From 49e9beea54b7ada9ab5d09e6f9cd93a489d87e23 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 20 三月 2025 13:50:21 +0800 Subject: [PATCH] fix:上传 --- LifePayment/LifePayment.Application/User/AccountService.cs | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs index 96b3ae8..2c46855 100644 --- a/LifePayment/LifePayment.Application/User/AccountService.cs +++ b/LifePayment/LifePayment.Application/User/AccountService.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp; @@ -27,6 +28,7 @@ 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( @@ -35,7 +37,8 @@ IIdentityModelAuthenticationService authenticator, IRepository<User, Guid> userRepository, IIdentityUserAppService identityUserService, - IRepository<LifePayUser, Guid> lifePayUserRepository) + IRepository<LifePayUser, Guid> lifePayUserRepository, + IRepository<UserChannle, Guid> userChannleRep) { _configuration = configuration; _wxManager = wxManager; @@ -43,6 +46,7 @@ _lifePayUserRepository = lifePayUserRepository; _authenticator = authenticator; _userRepository = userRepository; + _userChannleRep = userChannleRep; } #region 鏌ヨ @@ -92,6 +96,7 @@ lifeUser = new LifePayUser() { Id = GuidGenerator.Create(), + CreationChannleNum = input.CheckChannelId, PhoneNumber = input.PhoneNumber, LastLoginTime = DateTime.Now }; @@ -100,6 +105,7 @@ } else { + lifeUser.LastLoginChannleNum = input.CheckChannelId; lifeUser.LastLoginTime = DateTime.Now; await _lifePayUserRepository.UpdateAsync(lifeUser); } @@ -128,7 +134,7 @@ 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) { @@ -140,8 +146,10 @@ 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, @@ -149,7 +157,7 @@ UserName = input.UserName, RoleNames = input.RoleNames, ClientId = input.ClientId, - Password = password, + Password = input.Password, }); var user = await _userRepository.InsertAsync(new User { @@ -168,6 +176,19 @@ 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 -- Gitblit v1.9.1