CrazyIter_Bin 3 лет назад
Родитель
Сommit
f23e3e05c4
1 измененных файлов с 33 добавлено и 30 удалено
  1. 33 30
      TEAMModelOS.SDK/Models/Service/GroupListService.cs

+ 33 - 30
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -991,46 +991,49 @@ namespace TEAMModelOS.SDK
                     }
                     }
                 }
                 }
 
 
-                ///获取真实的名称 
-                var content = new StringContent(tmdids.Select(x => x.id).ToJsonString(), Encoding.UTF8, "application/json");
-                string json = null;
-                try
-                {
-                     json = await _coreAPIHttpService.GetUserInfos(content);
-                    if (!string.IsNullOrWhiteSpace(json))
+                if (tmdids.Any()) {
+                    ///获取真实的名称 
+                    var content = new StringContent(tmdids.Select(x => x.id).ToJsonString(), Encoding.UTF8, "application/json");
+                    string json = null;
+                    try
                     {
                     {
-                    
-                        List<TmdInfo> tmdInfos = json.ToObject<List<TmdInfo>>();
-                        if (tmdInfos.IsNotEmpty())
+                        json = await _coreAPIHttpService.GetUserInfos(content);
+                        if (!string.IsNullOrWhiteSpace(json))
                         {
                         {
-                            tmdsData.ForEach(y =>
+
+                            List<TmdInfo> tmdInfos = json.ToObject<List<TmdInfo>>();
+                            if (tmdInfos.IsNotEmpty())
                             {
                             {
-                                var tmd = tmdInfos.Find(x => x.id.Equals(y.id));
-                                if (tmd != null)
-                                {
-                                    y.name = tmd?.name;
-                                    y.picture = tmd?.picture;
-                                }
-                                else
+                                tmdsData.ForEach(y =>
                                 {
                                 {
-                                    groups.ForEach(x =>
+                                    var tmd = tmdInfos.Find(x => x.id.Equals(y.id));
+                                    if (tmd != null)
+                                    {
+                                        y.name = tmd?.name;
+                                        y.picture = tmd?.picture;
+                                    }
+                                    else
                                     {
                                     {
-                                        int item = x.members.RemoveAll(z => z.id.Equals(y.id) && z.type == 1);
-                                        if (item > 0)
+                                        groups.ForEach(x =>
                                         {
                                         {
-                                            changes.Add(x);
-                                        }
-                                    });
-                                }
-                            });
-                        }
+                                            int item = x.members.RemoveAll(z => z.id.Equals(y.id) && z.type == 1);
+                                            if (item > 0)
+                                            {
+                                                changes.Add(x);
+                                            }
+                                        });
+                                    }
+                                });
+                            }
 
 
                         }
                         }
                     }
                     }
-                catch (Exception ex)
-                {
-                    await _dingDing.SendBotMsg($"{_coreAPIHttpService.options.Get("Default").location}用户转换失败:{_coreAPIHttpService.options.Get("Default").url}{json}\n {ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+                    catch (Exception ex)
+                    {
+                        await _dingDing.SendBotMsg($"{_coreAPIHttpService.options.Get("Default").location}用户转换失败:{_coreAPIHttpService.options.Get("Default").url}{json}\n {ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+                    }
                 }
                 }
+               
                 tmdids.ForEach(x =>
                 tmdids.ForEach(x =>
                 {
                 {
                     var user = tmdsData.Find(y => y.id.Equals(x.id));
                     var user = tmdsData.Find(y => y.id.Equals(x.id));