Esempio n. 1
0
// 获取分页上架的商品
func (this *saleService) GetShopPagedOnShelvesGoods(merchantId, categoryId, start, end int,
	sortBy string) (total int, list []*valueobject.Goods) {
	var sl sale.ISale = this._rep.GetSale(merchantId)

	if categoryId > 0 {
		var cate sale.ICategory = sl.CategoryManager().GetCategory(categoryId)
		var ids []int = cate.GetChildes()
		ids = append(ids, categoryId)
		total, list = this._goodsRep.GetPagedOnShelvesGoods(merchantId, ids, start, end, "", sortBy)
	} else {
		total = -1
		list = sl.GoodsManager().GetOnShelvesGoods(start, end, sortBy)
	}
	for _, v := range list {
		v.Image = format.GetGoodsImageUrl(v.Image)
	}
	return total, list
}