예제 #1
0
        public string Get()
        {
            GetNoticeParams actionParams = JavaScriptConvert.DeserializeObject <GetNoticeParams>(JsonParams);

            if (actionParams.UId <= 0)
            {
                return("");
            }
            GetNoticeResponse getNoticeResponse = new GetNoticeResponse();

            getNoticeResponse.Message.UnRead = PrivateMessages.GetPrivateMessageCount(actionParams.UId, 0, 1);
            DateTime time = new DateTime();

            if (getNoticeResponse.Message.UnRead > 0)
            {
                getNoticeResponse.Message.MostRecent = Utils.ConvertToUnixTimestamp(DateTime.TryParse(PrivateMessages.GetPrivateMessageInfo(PrivateMessages.GetLatestPMID(actionParams.UId)).Postdatetime, out time) ? time : DateTime.Now);
            }

            getNoticeResponse.Notification.UnRead = Notices.GetNoticeCount(actionParams.UId, 1);
            if (getNoticeResponse.Notification.UnRead > 0)
            {
                getNoticeResponse.Notification.MostRecent = Utils.ConvertToUnixTimestamp(DateTime.TryParse(Notices.GetNewNotices(actionParams.UId)[0].Postdatetime, out time) ? time : DateTime.Now);
            }

            List <FriendshipRequestInfo> requestList = Friendship.GetUserFriendRequestList(actionParams.UId, 1, Friendship.GetUserFriendRequestCount(actionParams.UId));

            getNoticeResponse.FriendRequest.UIds = GetFriendRequestUid(requestList);
            if (getNoticeResponse.FriendRequest.UIds.Length > 0)
            {
                getNoticeResponse.FriendRequest.MostRecent = Utils.ConvertToUnixTimestamp(DateTime.TryParse(requestList[requestList.Count - 1].DateTime, out time) ? time : DateTime.Now);
            }

            return(GetResult(getNoticeResponse));
        }