/// <summary> /// 查询列表 /// </summary> /// <param name="refer"></param> /// <returns></returns> public HotStyleRefer QueryHotStylePageList(HotStyleRefer refer) { var req = refer.Search; var ret = new HotStyleRefer(); var isEnable = !(req.QueryIsEnable == 2); var response = GoodsClient.Send <GetHotProductListResponse>(new GetHotProductList { ProductId = req.ProductId, ProductName = req.ProductName, ApplyPlace = req.ApplyPlace, IsEnable = isEnable, IsExpire = req.IsExpire, PageIndex = refer.PageIndex, PageSize = refer.PageSize, }); ret.List = Mapper.MappGereric <GetHotProductDto, HotStyleModel>(response.Dtos); var list = ret.List; var goodsList = list.Select(c => c.ProductId ?? 0).ToList(); //商品名称接入统一商品 if (goodsList.Any()) { var dictory = QueryUnionGoodsNameList(goodsList); foreach (var item in list) { if (string.IsNullOrEmpty(item.ProductName)) { item.ProductName = dictory.First(c => c.Key == item.ProductId).Value; } } } var coutryKv = typeof(AppEnum.HotCountryEnum).GetEnumList(); foreach (var item in list) { if (item.CountryId == 0) { item.CountryName = ""; } else { item.CountryName = coutryKv.First(c => c.Key == (item.CountryId ?? 0)).Value; } } ret.PageIndex = response.PageIndex; ret.PageSize = response.PageSize; ret.Total = response.Total; return(ret); }
// // GET: /HotStyle/ public ActionResult Index(HotStyleRefer refer) { if (refer.Search.ApplyPlace == null) { refer.Search.ApplyPlace = "1"; } if (refer.Search.IsExpire == null) { refer.Search.IsExpire = 1; } if (refer.Search.IsEnable == null) { refer.Search.IsEnable = true; } var result = HotStyleClient.Instance.QueryHotStylePageList(refer); return(View(result)); }