// 获取商品值 func (this *saleService) GetValueGoods(merchantId, goodsId int) *valueobject.Goods { sl := this._rep.GetSale(merchantId) var goods sale.IGoods = sl.GoodsManager().GetGoods(goodsId) if goods != nil { return goods.GetPackedValue() } return nil }
// 获取商品详情 func (this *saleService) GetGoodsDetails(mchId, goodsId, mLevel int) (*valueobject.Goods, map[string]string) { sl := this._rep.GetSale(mchId) var goods sale.IGoods = sl.GoodsManager().GetGoods(goodsId) gv := goods.GetPackedValue() proMap := goods.GetPromotionDescribe() if b, price := goods.GetLevelPrice(mLevel); b { gv.PromPrice = price proMap["会员专享"] = fmt.Sprintf("会员优惠,仅需<b>¥%s</b>", format.FormatFloat(price)) } return gv, proMap }
// 根据SKU获取商品 func (this *saleService) GetGoodsBySku(merchantId int, itemId int, sku int) *valueobject.Goods { sl := this._rep.GetSale(merchantId) var goods sale.IGoods = sl.GoodsManager().GetGoodsBySku(itemId, sku) return goods.GetPackedValue() }