本文整理汇总了Golang中go2o/src/core/domain/interface/sale.ISale类的典型用法代码示例。如果您正苦于以下问题:Golang ISale类的具体用法?Golang ISale怎么用?Golang ISale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ISale类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: saveOrderOnSubmit
// 保存订单
func (this *Order) saveOrderOnSubmit() (int, error) {
cartItems := this._cart.GetValue().Items
if this._value.Items == nil {
this._value.Items = make([]*shopping.OrderItem, len(cartItems))
}
var sl sale.ISale = this._saleRep.GetSale(this._value.PartnerId)
var item sale.IItem
var snap *sale.GoodsSnapshot
for i, v := range cartItems {
snap = sl.GetGoodsSnapshot(cartItems[i].SnapshotId)
if snap == nil {
return 0, errors.New("商品缺少快照:" + item.GetValue().Name)
}
this._value.Items[i] = &shopping.OrderItem{
Id: 0,
SnapshotId: snap.Id,
Quantity: v.Num,
Sku: "",
Fee: v.SalePrice * float32(v.Num),
}
}
return this._shoppingRep.SaveOrder(this._shopping.GetAggregateRootId(), this._value)
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:26,代码来源:order.go
示例2: GetPagedOnShelvesGoods
// 获取分页上架的商品
func (this *saleService) GetPagedOnShelvesGoods(partnerId, categoryId, start, end int,
sortQuery string) (int, []*valueobject.Goods) {
var sl sale.ISale = this._rep.GetSale(partnerId)
var cate sale.ICategory = sl.GetCategory(categoryId)
var ids []int = cate.GetChildId()
ids = append(ids, categoryId)
//todo: cache
var where string
var orderBy string
switch sortQuery {
case "price_0":
where = ""
orderBy = "gs_item.sale_price ASC"
case "price_1":
where = ""
orderBy = "gs_item.sale_price DESC"
case "sale_0":
where = ""
orderBy = "gs_goods.sale_num ASC"
case "sale_1":
where = ""
orderBy = "gs_goods.sale_num DESC"
case "rate_0":
//todo:
case "rate_1":
//todo:
}
return this._goodsRep.GetPagedOnShelvesGoods(partnerId, ids, start, end, where, orderBy)
}
开发者ID:tonycoming,项目名称:go2o,代码行数:33,代码来源:sale_service.go
示例3: GetPagedOnShelvesGoods
// 获取分页上架的商品
func (this *saleService) GetPagedOnShelvesGoods(partnerId, categoryId, start, end int) (int, []*valueobject.Goods) {
var sl sale.ISale = this._rep.GetSale(partnerId)
var cate sale.ICategory = sl.GetCategory(categoryId)
var ids []int = cate.GetChildId()
ids = append(ids, categoryId)
//todo: cache
return this._goodsRep.GetPagedOnShelvesGoods(partnerId, ids, start, end)
}
开发者ID:kevinhuo88888,项目名称:go2o,代码行数:11,代码来源:sale_service.go
示例4: setAttachGoodsInfo
// 设置附加的商品信息
func (this *Cart) setAttachGoodsInfo(items []*shopping.ValueCartItem) {
if items != nil {
l := len(items)
if l == 0 {
return
}
var ids []int = make([]int, l)
for i, v := range items {
ids[i] = v.GoodsId
}
// 设置附加的值
goods, err := this._goodsRep.GetGoodsByIds(ids...)
if err == nil {
var goodsMap = make(map[int]*valueobject.Goods, len(goods))
for _, v := range goods {
goodsMap[v.GoodsId] = v
}
var level int
var goods sale.IGoods
var sl sale.ISale
// 更新登陆后的优惠价
if this._value.BuyerId > 0 {
sl = this._saleRep.GetSale(this._partnerId)
m, _ := this._memberRep.GetMember(this._value.BuyerId)
if m != nil {
level = m.GetValue().Level
}
}
for _, v := range items {
gv, ok := goodsMap[v.GoodsId]
if level > 0 {
goods = sl.CreateGoods(
sl.CreateItem(sale.ParseToPartialValueItem(gv)),
sale.ParseToValueGoods(gv),
)
if p := goods.GetPromotionPrice(level); p < gv.SalePrice {
gv.SalePrice = p
}
}
if ok {
v.Name = gv.Name
v.Price = gv.Price
v.GoodsNo = gv.GoodsNo
v.Image = gv.Image
v.SalePrice = gv.SalePrice
}
}
}
}
}
开发者ID:sunxboy,项目名称:go2o,代码行数:55,代码来源:cart.go
注:本文中的go2o/src/core/domain/interface/sale.ISale类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论