コード例 #1
0
        public ApiResponse GetNewsList(string cids = "1705", int pagesize = 10, int pageindex = 1)
        {
            var channelids = cids;
            int count      = 0;
            var wcmlist    = newsbll.GetWcmDocumentsListByChanleIds(channelids, pageindex, pagesize, ref count);

            var list = new List <MobileNews>();

            if (wcmlist != null)
            {
                list.AddRange(from item in wcmlist
                              let imgurl = newsbll.GetNewsFirstImagePath(item.DOCPUBURL, item.DOCHTMLCON)
                                           select new MobileNews()
                {
                    NewsId     = item.DOCID,
                    Title      = item.DOCTITLE,
                    ShowImg    = string.IsNullOrEmpty(imgurl) ? "http://m.ZJB.com/images/news_default.jpg" : imgurl,
                    Replaytime = DateTimeUtility.ToUnixTime(Convert.ToDateTime(item.DOCRELTIME)),
                    Hits       = item.HitsCount,
                    Pls        = item.replaynum,
                });
            }
            return(new ApiResponse(Metas.SUCCESS, list, count));
        }