public async Task <ApiResult> Search(GoodsSearchModel model) { string parm = doMain; GoodsSearchResult result = await goodsService.SearchAsync(model.KeyWord, null, null, model.PageIndex, model.PageSize); List <SearchResultModel> lists; lists = result.Goods.Select(g => new SearchResultModel { id = g.Id, inventory = g.Inventory, name = g.Name, price = g.Price, realityPrice = g.RealityPrice, saleNum = g.SaleNum, imgUrl = parm + goodsImgService.GetFirstImg(g.Id) }).ToList(); GoodsSearchApiModel apiModel = new GoodsSearchApiModel(); apiModel.goods = lists; apiModel.pageCount = result.PageCount; return(new ApiResult { status = 1, data = apiModel }); }
public async Task <ApiResult> List(GoodsListModel model) { string parm = await settingService.GetParmByNameAsync("网站域名"); GoodsSearchResult result = await goodsService.FrontModelListAsync(model.AreaId, model.TypeId, model.SecondTypeId, null, null, null, model.PageIndex, model.PageSize); List <SearchResultModel> lists; lists = result.Goods.Select(g => new SearchResultModel { id = g.Id, inventory = g.Inventory, name = g.Name, realityPrice = g.RealityPrice, saleNum = g.SaleNum, imgUrl = parm + goodsImgService.GetFirstImg(g.Id) }).ToList(); GoodsSearchApiModel apiModel = new GoodsSearchApiModel(); apiModel.goods = lists; apiModel.pageCount = result.PageCount; return(new ApiResult { status = 1, data = apiModel }); }