예제 #1
0
// 根据销售标签获取指定数目的商品
func (this *saleService) GetValueGoodsBySaleLabel(merchantId int,
	code, sortBy string, begin int, end int) []*valueobject.Goods {
	sl := this._rep.GetSale(merchantId)
	if tag := sl.LabelManager().GetSaleLabelByCode(code); tag != nil {
		list := tag.GetValueGoods(sortBy, begin, end)
		for _, v := range list {
			v.Image = format.GetGoodsImageUrl(v.Image)
		}
		return list
	}
	return make([]*valueobject.Goods, 0)
}
예제 #2
0
func (this *saleService) GetPagedOnShelvesGoods(categoryId, start, end int,
	sortBy string) (total int, list []*valueobject.Goods) {
	if categoryId > 0 {
		cate := this._cateRep.GetGlobManager().GetCategory(categoryId)
		var ids []int = cate.GetChildes()
		ids = append(ids, categoryId)
		total, list = this._goodsRep.GetPagedOnShelvesGoods(0, ids, start, end, "", sortBy)
	} else {
		total = -1
		total, list = this._goodsRep.GetPagedOnShelvesGoods(0, []int{}, start, end, "", sortBy)
	}
	for _, v := range list {
		v.Image = format.GetGoodsImageUrl(v.Image)
	}
	return total, list
}
예제 #3
0
파일: cart.go 프로젝트: yonglehou/go2o
func ParseCartItem(item *CartItem) *dto.CartItem {
	i := &dto.CartItem{
		GoodsId:    item.SkuId,
		GoodsName:  item.Name,
		GoodsNo:    item.GoodsNo,
		SmallTitle: item.SmallTitle,
		GoodsImage: format.GetGoodsImageUrl(item.Image),
		Quantity:   item.Quantity,
		Price:      item.Price,
		SalePrice:  item.SalePrice,
	}
	if item.Checked == 1 {
		i.Checked = true
	}
	return i
}
예제 #4
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
}