fix: 防止重复注册意社区账号

This commit is contained in:
chenchun
2025-08-29 14:31:04 +08:00
parent 7905911624
commit 2ae6183e7f

View File

@@ -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
{