fix: 防止重复注册意社区账号
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user