From c24ef16e11d4ac0cd8638278f4005ebb1cf084f7 Mon Sep 17 00:00:00 2001 From: wzh425 Date: Wed, 30 Aug 2023 13:55:33 +0800 Subject: [PATCH] fix : Users without device IDs did not generate message records (#549) --- .../Provider/Auth/AuthChannelUserFinder.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Services/Masa.Mc.Service/Infrastructure/ChannelUserFinder/Provider/Auth/AuthChannelUserFinder.cs b/src/Services/Masa.Mc.Service/Infrastructure/ChannelUserFinder/Provider/Auth/AuthChannelUserFinder.cs index 0b56b00d..ca53441e 100644 --- a/src/Services/Masa.Mc.Service/Infrastructure/ChannelUserFinder/Provider/Auth/AuthChannelUserFinder.cs +++ b/src/Services/Masa.Mc.Service/Infrastructure/ChannelUserFinder/Provider/Auth/AuthChannelUserFinder.cs @@ -63,7 +63,16 @@ public async Task> TransformUserReceivers(AppCh private async Task> GetUserClientIds(AppChannel channel, List userIds) { var userSystemDatas = await _authClient.UserService.GetSystemListDataAsync(userIds, $"{MasaStackProject.MC.Name}:{channel.Code}"); - return userSystemDatas.ToDictionary(x => x.Key, x => x.Value?.ClientId ?? string.Empty); + var userClientIds = userIds.ToDictionary(x => x, x => + { + if (!userSystemDatas.Any(y => y.Key == x)) + { + return string.Empty; + } + var userSystemData = userSystemDatas.FirstOrDefault(y => y.Key == x); + return userSystemData.Value?.ClientId ?? string.Empty; + }); + return userClientIds; } private async Task> TransformDepartmentReceiversAsync(AppChannel channel, ExtraPropertyDictionary variables, IEnumerable receivers)