本文整理汇总了Golang中go2o/src/core/domain/interface/shopping.ValueCart类的典型用法代码示例。如果您正苦于以下问题:Golang ValueCart类的具体用法?Golang ValueCart怎么用?Golang ValueCart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueCart类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetLatestCart
// 获取最新的购物车
func (this *shoppingRep) GetLatestCart(buyerId int) (*shopping.ValueCart, error) {
var v = new(shopping.ValueCart)
err := this.Connector.GetOrm().GetBy(v, "buyer_id=? ORDER BY id DESC", buyerId)
if v == nil || err != nil {
return nil, err
}
var items = []*shopping.ValueCartItem{}
err = this.Connector.GetOrm().Select(&items, "cart_id=?", v.Id)
if err == nil {
v.Items = items
}
return v, err
}
示例2: GetShoppingCart
// 获取购物车
func (this *shoppingRep) GetShoppingCart(key string) (*shopping.ValueCart, error) {
var v = new(shopping.ValueCart)
err := this.Connector.GetOrm().GetBy(v, "cart_key=?", key)
if v == nil || err != nil {
return nil, err
}
var items = []*shopping.ValueCartItem{}
err = this.Connector.GetOrm().Select(&items, "cart_id=?", v.Id)
if err == nil {
v.Items = items
}
return v, err
}
示例3: GetNotBoughtCart
// 获取未结算的购物车
func (this *shoppingRep) GetNotBoughtCart(buyerId int) (*shopping.ValueCart, error) {
var v = new(shopping.ValueCart)
err := this.Connector.GetOrm().GetBy(v, "is_bought=0 AND buyer_id=?", buyerId)
if v == nil || err != nil {
return nil, err
}
var items = []*shopping.ValueCartItem{}
err = this.Connector.GetOrm().Select(&items, "cart_id=?", v.Id)
if err == nil {
v.Items = items
}
this.setAttachGoodsInfo(v.Items)
return v, err
}