/// <summary> /// 获取群聊个人头像 /// </summary> /// <param name="GroupMembers"></param> /// <param name="msg"></param> /// <returns></returns> public static string getPathImage(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg) { //获取接收者头像 string pathImages = ""; //获取接收者头像 var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId); AntSdkGroupMember users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null; if (listUser == null) { if (users == null) { AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId); if (cuss == null) { //users = new AntSdkGroupMember(); pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20"); //users.picture = pathImages; //users.userName = "******"; } else { if (string.IsNullOrEmpty(cuss.picture + "")) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = cuss.picture; } } } else { if (string.IsNullOrEmpty(users.picture)) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = users.picture; } } } else { if (string.IsNullOrEmpty(listUser.Url)) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = "file:///" + listUser.Url.Replace(@"\", @"/").Replace(" ", "%20"); } } return(pathImages); }
/// <summary> /// 获取获取对应群员信息 /// </summary> /// <param name="GroupMembers"></param> /// <returns></returns> public static AntSdkGroupMember getGroupMembersUser(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg) { string pathImages = ""; //获取接收者头像 var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId); //var users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null; var users = new AntSdkGroupMember(); //if (users == null) //{ AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId); if (cuss == null) { users = new AntSdkGroupMember(); pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20"); users.picture = pathImages; users.userId = msg.sendUserId; users.userName = "******"; } else { users = new AntSdkGroupMember { userId = cuss.userId, userName = cuss.status == 0 && cuss.state == 0 ? cuss.userName + "(停用)":cuss.userName, userNum = cuss.userNum, picture = cuss.picture, position = cuss.position }; } //} return(users); }
/// <summary> /// 触发系统信息接收事件 /// </summary> /// <param name="activeInstantMessage">活动的即时消息</param> public void TriggerInstantSystemMessageHasBeenReceivedEvent(int mtp, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase systemInstantMessage) { InstantSystemMessageHasBeenReceived?.Invoke(mtp, systemInstantMessage); }