示例#1
0
        public void GetList(HttpContext context)
        {
            int index    = GetInt("start");
            int size     = GetInt("limit");
            int sid      = GetInt("sellerid");
            var merchant = MerchantHelper.GetMerchant(sid);

            var results = ActiveHelper.GetPagings(sid, index * size, size);
            var data    = new List <object>();

            foreach (var r in results.Results)
            {
                string url = string.Empty;
                if (merchant.MerType == MerchantTypes.Night)
                {
                    url = Utility.GetSizePicUrl(r.CoverImgUrl, 450, 190, context);
                }
                else
                {
                    url = Utility.GetSizePicUrl(r.CoverImgUrl, 180, 143, context);
                }

                var d = new
                {
                    newid      = r.Id,
                    title      = r.Title,
                    img        = Utility.GetPhoneNeedUrl(url),
                    dateline   = r.CreateTime.GetUnixTime(),
                    summary    = r.Summary,
                    descrition = r.Description,
                    Views      = r.Views,
                    Commentnum = r.Commentnum
                };
                data.Add(d);
            }

            JsonTransfer jt = new JsonTransfer();

            jt.AddSuccessParam();
            jt.Add("data", data);
            Response.Write(DesEncrypt(jt).ToLower());
            Response.End();
        }
示例#2
0
        public void GetList()
        {
            int index = GetInt("start");
            int size  = GetInt("limit");
            int sid   = GetInt("sellerid");

            var data   = ActiveHelper.GetPagings(sid, index * size, size);
            var result = new PagResults <object>();

            result.TotalCount = data.TotalCount;
            foreach (var item in data.Results)
            {
                var o = new
                {
                    Id          = item.Id,
                    SellerId    = item.SellerId,
                    Summary     = item.Summary,
                    Title       = item.Title,
                    Views       = item.Views,
                    Commentnum  = item.Commentnum,
                    ImgId       = item.CoverImgId,
                    HasCoupon   = item.CouponId != 0,
                    ImgUrl      = item.CoverImgUrl == "" ? "http://placehold.it/128x128" : item.CoverImgUrl,
                    CreateTime  = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    Description = item.Description
                };
                result.Results.Add(o);
            }

            JsonTransfer jt = new JsonTransfer();

            jt.AddSuccessParam();
            jt.Add("data", result);
            Response.Write(DesEncrypt(jt).ToLower());
            Response.End();
        }