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 92195f2d..c5d36ad3 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 @@ -226,6 +226,11 @@ public class FuwuhaoService : ApplicationService var result = await _fileService.Post(files); + if (await _userRepository.IsAnyAsync(x=>x.FuwuhaoOpenId==userInfo.OpenId)) + { + throw new UserFriendlyException("你已注册过意社区账号"); + } + var userId = await _accountService.PostSystemRegisterAsync(new RegisterDto { UserName = $"wx{Random.Shared.Next(100000, 999999)}", @@ -235,6 +240,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 {