diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/FuwuhaoService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/FuwuhaoService.cs index a39e7ca6..92195f2d 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/FuwuhaoService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/FuwuhaoService.cs @@ -10,11 +10,13 @@ using Volo.Abp.Application.Services; using Volo.Abp.Caching; using Volo.Abp.Users; using Yi.Framework.AiHub.Application.Contracts.Dtos.Fuwuhao; +using Yi.Framework.AiHub.Domain.Entities; using Yi.Framework.AiHub.Domain.Managers.Fuwuhao; using Yi.Framework.AiHub.Domain.Shared.Consts; using Yi.Framework.AiHub.Domain.Shared.Enums.Fuwuhao; using Yi.Framework.Rbac.Application.Contracts.Dtos.Account; using Yi.Framework.Rbac.Application.Contracts.IServices; +using Yi.Framework.SqlSugarCore.Abstractions; namespace Yi.Framework.AiHub.Application.Services; @@ -28,14 +30,14 @@ public class FuwuhaoService : ApplicationService private readonly FuwuhaoManager _fuwuhaoManager; private IDistributedCache _sceneCache; private IDistributedCache _openIdToSceneCache; - + private ISqlSugarRepository _userRepository; private IAccountService _accountService; private IFileService _fileService; public IDistributedLockProvider DistributedLock => LazyServiceProvider.LazyGetService(); public FuwuhaoService(ILogger logger, IHttpContextAccessor accessor, FuwuhaoManager fuwuhaoManager, IDistributedCache sceneCache, IAccountService accountService, IFileService fileService, - IDistributedCache openIdToSceneCache) + IDistributedCache openIdToSceneCache, ISqlSugarRepository userRepositroy) { _logger = logger; _accessor = accessor; @@ -44,6 +46,7 @@ public class FuwuhaoService : ApplicationService _accountService = accountService; _fileService = fileService; _openIdToSceneCache = openIdToSceneCache; + _userRepository = userRepositroy; } /// @@ -223,7 +226,7 @@ public class FuwuhaoService : ApplicationService var result = await _fileService.Post(files); - await _accountService.PostSystemRegisterAsync(new RegisterDto + var userId = await _accountService.PostSystemRegisterAsync(new RegisterDto { UserName = $"wx{Random.Shared.Next(100000, 999999)}", Password = Guid.NewGuid().ToString("N"), @@ -232,6 +235,7 @@ public class FuwuhaoService : ApplicationService Nick = userInfo.Nickname, Icon = result.FirstOrDefault()?.Id.ToString() }); + await _userRepository.InsertAsync(new AiUserExtraInfoEntity(userId, userInfo.OpenId)); await _sceneCache.SetAsync($"{FuwuhaoConst.SceneCacheKey}:{scene}", new SceneCacheDto { SceneResult = SceneResultEnum.Register