コード例 #1
0
        public ApiResponse DynamicList(int pageSize = 10, long lastTime = 253367971200, int pageIndex = 1)
        {
            int            uid    = GetCurrentUserId();
            DynamicListReq parame = new DynamicListReq();

            parame.PageSize = pageSize;

            if (lastTime == 0)
            {
                parame.LastTime = DateTime.Now;
            }
            else
            {
                parame.LastTime = DateTimeUtility.FromUnixTime(lastTime);
            }

            parame.UserId       = uid;
            parame.IsGetSupport = 1;
            parame.FirstComming = pageIndex == 1? 1 : 0;
            List <DynamicModel> dynamicList = dynamicBll.DynamicList(parame);

            List <DynamicImage> dynamicImageList  = new List <DynamicImage>();
            List <DynamicModel> dynamicReplayList = new List <DynamicModel>();

            if (dynamicList.IsNoNull() && dynamicList.Count > 0)
            {
                dynamicImageList = dynamicBll.DynamicImageListBydynamicIds(dynamicList.Select(s => s.Id).ToList());


                List <int> list = dynamicList.Select(s => s.Id).ToList();
                string     ids  = "";
                foreach (int id in list)
                {
                    ids += "," + id;
                }
                if (ids.StartsWith(","))
                {
                    ids = ids.Substring(1);
                }
                dynamicReplayList = dynamicBll.DynamicReplayListBydynamicIds(ids, 5, 0);
            }
            if (dynamicList != null && dynamicList.Count > 0)
            {
                return(new ApiResponse(Metas.SUCCESS, FormatDynamicList(dynamicList, dynamicImageList, dynamicReplayList, uid)));
            }
            return(new ApiResponse(Metas.SUCCESS));
        }