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); }
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)); }
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; }