func (this *shoppingService) parseCart(c cart.ICart) *dto.ShoppingCart { dto := cart.ParseToDtoCart(c) for _, v := range dto.Vendors { mch, _ := this._mchRep.GetMerchant(v.VendorId) v.VendorName = mch.GetValue().Name if v.ShopId > 0 { v.ShopName = mch.ShopManager().GetShop(v.ShopId).GetValue().Name } } return dto }
// 创建一个新的购物车 func (this *shoppingService) CreateShoppingCart(memberId int) *dto.ShoppingCart { c := this._cartRep.NewCart() c.SetBuyer(memberId) return cart.ParseToDtoCart(c) }