示例#1
0
 public LMSresult GetMoreList(string m, long start)
 {
     var t = (long) (DateTime.UtcNow.AddMonths(-1).Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds;
     var items = new List<PostMessage>();
     var t1 = DateTime.Now;
     var n = 1;
     var i = 1;
     var end = start;
     while (items.Count < 5 && end > t)
     {
         i = i + n;
         start = start - (long) TimeSpan.FromHours(i).TotalMilliseconds;
         var path = m.Split('/');
         items = _iDbService.DocumentDb.GetPostMessages(start, end);
         var t2 = DateTime.Now;
         if ((t2 - t1 > TimeSpan.FromSeconds(10)) || n > 12)
         {
             return new LMSresult
             {
                 moreData = true,
                 time = end,
                 list = items
             };
         }
         n++;
     }
     var res = new LMSresult
     {
         moreData = false,
         time = start,
         list = items
     };
     return res;
 }
示例#2
0
        public LMSresult GetList(string m)
        {
            var end = (long) (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds;
            var n = 0;
            var items = new List<PostMessage>();
            while (items.Count < 5 && n < 6)
            {
                end = end - (long) TimeSpan.FromMinutes(30).TotalMilliseconds;
                var path = m.Split('/');
                items = _iDbService.DocumentDb.GetPostMessages(end);
                n++;
            }

            var res = new LMSresult
            {
                time = end,
                list = items
            };
            return res;
        }