internal void SendModuleMail(ModuleMailInfo moduleMail, int validityPeriod) { moduleMail.m_MailGuid = GenMailGuid(); moduleMail.m_SendTime = DateTime.Now; moduleMail.m_ExpiryDate = moduleMail.m_SendTime.AddDays(validityPeriod); m_ModuleMails.Add(moduleMail); JsonMessageNotifyNewMail newMailMsg = new JsonMessageNotifyNewMail(); DataProcessScheduler dataProcess = LobbyServer.Instance.DataProcessScheduler; dataProcess.VisitUsers((UserInfo userInfo) => { newMailMsg.m_Guid = userInfo.Guid; JsonMessageDispatcher.SendDcoreMessage(userInfo.NodeName, newMailMsg); }); }
internal void SendUserMail(MailInfo userMail, int validityPeriod) { userMail.m_MailGuid = GenMailGuid(); userMail.m_SendTime = DateTime.Now; userMail.m_ExpiryDate = userMail.m_SendTime.AddDays(validityPeriod); List <MailInfo> mails = null; if (!m_UserMails.TryGetValue(userMail.m_Receiver, out mails)) { mails = new List <MailInfo>(); m_UserMails.Add(userMail.m_Receiver, mails); } mails.Add(userMail); DataProcessScheduler dataProcess = LobbyServer.Instance.DataProcessScheduler; UserInfo user = dataProcess.GetUserInfo(userMail.m_Receiver); if (null != user && user.CurrentState != UserState.DropOrOffline) { JsonMessageNotifyNewMail newMailMsg = new JsonMessageNotifyNewMail(); newMailMsg.m_Guid = userMail.m_Receiver; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, newMailMsg); } }