Ejemplo n.º 1
0
        private HotPageData <List <GoodsViewModel> > GetGoodsList(HQRequestHeader header, HotGoodsSearchCondition condition)
        {
            HotPageData <List <HotGoodsModel> >  pageData     = GoodsProviderFactory.GetInstance(header.platType).GetGoodsList(condition, out string errMsg);
            HotPageData <List <GoodsViewModel> > pageViewData = new HotPageData <List <GoodsViewModel> >();

            pageViewData.PageCount = pageData.PageCount;
            pageViewData.PageIndex = pageData.PageIndex;
            pageViewData.PageSize  = pageData.PageSize;
            pageViewData.Total     = pageData.Total;
            List <GoodsViewModel> viewList = new List <GoodsViewModel>();

            foreach (HotGoodsModel goodsInfo in pageData.Rows)
            {
                GoodsViewModel viewInfo = new GoodsViewModel();
                viewInfo.couponPrice = goodsInfo.CouponDiscount.ToString("F2");
                viewInfo.earnMoney   = goodsInfo.PromotionAmount.ToString("F2");//????要乘一个百分比
                viewInfo.finalPrice  = goodsInfo.CouponedPrice.ToString("F2");
                viewInfo.goodsId     = goodsInfo.GoodsId;
                viewInfo.goodsIntro  = goodsInfo.GoodsDesc;
                viewInfo.goodsPrice  = goodsInfo.MinGroupPrice.ToString("F2");
                viewInfo.imgs        = goodsInfo.GoodsGalleryUrls.ToArray();
                viewInfo.imgSrc      = goodsInfo.GoodsThumbnailUrl;
                viewInfo.isFav       = false;//???赋值
                viewInfo.platform    = header.platType;
                viewInfo.salesVolume = goodsInfo.SoldQuantity;
                viewInfo.title       = goodsInfo.GoodsName;
                viewList.Add(viewInfo);
            }
            pageViewData.Rows = viewList;
            return(pageViewData);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            HotPageData <List <HotGoodsModel> > pageData = GoodsProviderFactory.GetInstance(HQEnums.PlatformTypeOptions.拼多多).GetGoodsList(new HotGoodsSearchCondition()
            {
                SortField = HotGoodsSortFieldOptions.默认,
                SortType  = HotGoodsSortTypeOptions.ASC
            }, out string errMsg);

            MessageBox.Show(JsonConvert.SerializeObject(pageData));


            //HotGoodsModel goodsInfo = GoodsProviderFactory.Current.GetGoodsDetail(1523581237, out string errDetailMsg);
            //MessageBox.Show(JsonConvert.SerializeObject(goodsInfo));
        }
Ejemplo n.º 3
0
        private void LoadList()
        {
            HotGoodsSearchCondition condition = this.GetSearchCondition();

            this.BindSearchCondition(condition);
            HotPageData <List <HotGoodsModel> > pageData = GoodsProviderFactory.GetInstance(HQEnums.PlatformTypeOptions.拼多多).GetGoodsList(condition, out string errMsg);

            if (errMsg != "")
            {
                Response.Write(errMsg);
                Response.End();
                return;
            }
            recordCount        = pageData.Total;
            rptList.DataSource = pageData.Rows;
            rptList.DataBind();
            pageCount = pageData.PageCount;
        }