public object GetVShopSearchProducts(long vshopId, string keywords = "", /* 搜索关键字 */ string exp_keywords = "", /* 渐进搜索关键字 */ long cid = 0, /* 分类ID */ long b_id = 0, /* 品牌ID */ string a_id = "", /* 属性ID, 表现形式:attrId_attrValueId */ int orderKey = 1, /* 排序项(1:默认,2:销量,3:价格,4:评论数,5:上架时间) */ int orderType = 1, /* 排序方式(1:升序,2:降序) */ int pageNo = 1, /*页码*/ int pageSize = 10 /*每页显示数据量*/ ) { long total; long shopId = -1; var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShop(vshopId); if (vshop != null) { shopId = vshop.ShopId; } if (!string.IsNullOrWhiteSpace(keywords)) { keywords = keywords.Trim(); } ProductSearch model = new ProductSearch() { shopId = shopId, BrandId = b_id, Ex_Keyword = exp_keywords, Keyword = keywords, OrderKey = orderKey, OrderType = orderType == 1, AttrIds = new System.Collections.Generic.List <string>(), PageNumber = pageNo, PageSize = pageSize, ShopCategoryId = cid }; var productsResult = ServiceProvider.Instance <IProductService> .Create.SearchProduct(model); total = productsResult.Total; var products = productsResult.Models.ToArray(); var productsModel = products.Select(item => new ProductItem() { Id = item.Id, ImageUrl = Core.MallIO.GetRomoteProductSizeImage(item.RelativePath, 1, (int)CommonModel.ImageSize.Size_350), SalePrice = item.MinSalePrice, Name = item.ProductName, //TODO:FG 循环内调用 CommentsCount = CommentApplication.GetProductCommentCount(item.Id), } ); var bizCategories = ServiceProvider.Instance <IShopCategoryService> .Create.GetShopCategory(shopId); var shopCategories = GetSubCategories(bizCategories, 0, 0); //统计店铺访问人数 StatisticApplication.StatisticShopVisitUserCount(vshop.ShopId); dynamic result = new ExpandoObject(); result.ShopCategory = shopCategories; result.Products = productsModel; result.VShopId = vshopId; result.Keywords = keywords; result.total = total; return(Json(new { result })); }