// 合并购物车,并返回新的购物车 func (this *cartImpl) Combine(c cart.ICart) cart.ICart { if c.GetAggregateRootId() != this.GetAggregateRootId() { for _, v := range c.GetValue().Items { if item, err := this.AddItem(v.VendorId, v.ShopId, v.SkuId, v.Quantity, v.Checked == 1); err == nil { if v.Checked == 1 { item.Checked = 1 } } } c.Destroy() //合并后,需销毁购物车 } this._snapMap = nil //clean return this }