本文整理汇总了Golang中go2o/src/core/domain/interface/sale.IGoods类的典型用法代码示例。如果您正苦于以下问题:Golang IGoods类的具体用法?Golang IGoods怎么用?Golang IGoods使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IGoods类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: GetValueGoods
// 获取商品值
func (this *saleService) GetValueGoods(partnerId, goodsId int) *valueobject.Goods {
sl := this._rep.GetSale(partnerId)
var goods sale.IGoods = sl.GetGoods(goodsId)
if goods != nil {
return goods.GetPackedValue()
}
return nil
}
开发者ID:zoe527,项目名称:go2o,代码行数:9,代码来源:sale_service.go
示例2: 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
示例3: addGoodsSaleNum
// 添加商品销售数量
func (this *Order) addGoodsSaleNum(snapshotId int, quantity int) error {
snapshot := this._saleRep.GetGoodsSnapshot(snapshotId)
if snapshot == nil {
return sale.ErrNoSuchSnapshot
}
var goods sale.IGoods = this._saleRep.GetSale(this._value.PartnerId).
GetGoods(snapshot.GoodsId)
if goods == nil {
return sale.ErrNoSuchGoods
}
return goods.AddSaleNum(quantity)
}
开发者ID:zoe527,项目名称:go2o,代码行数:14,代码来源:order.go
示例4: cancelGoods
// 取消商品
func (this *Order) cancelGoods() error {
for _, v := range this._value.Items {
snapshot := this._saleRep.GetGoodsSnapshot(v.SnapshotId)
if snapshot == nil {
return sale.ErrNoSuchSnapshot
}
var goods sale.IGoods = this._saleRep.GetSale(this._value.PartnerId).
GetGoods(snapshot.GoodsId)
if goods != nil {
goods.CancelSale(v.Quantity, this.GetOrderNo())
}
}
return nil
}
开发者ID:zoe527,项目名称:go2o,代码行数:15,代码来源:order.go
示例5: SaveGoods
func (this *saleService) SaveGoods(partnerId int, v *sale.ValueGoods) (int, error) {
sl := this._rep.GetSale(partnerId)
var pro sale.IGoods
if v.Id > 0 {
pro = sl.GetGoods(v.Id)
if pro == nil {
return 0, errors.New("产品不存在")
}
if err := pro.SetValue(v); err != nil {
return 0, err
}
} else {
pro = sl.CreateGoods(v)
}
return pro.Save()
}
开发者ID:honj51,项目名称:go2o,代码行数:16,代码来源:sale_service.go
示例6: GetGoodsDetails
// 获取商品详情
func (this *saleService) GetGoodsDetails(partnerId, goodsId, mLevel int) (*valueobject.Goods, map[string]string) {
sl := this._rep.GetSale(partnerId)
var goods sale.IGoods = sl.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
}
开发者ID:tonycoming,项目名称:go2o,代码行数:13,代码来源:sale_service.go
示例7: GetGoodsBySku
// 根据SKU获取商品
func (this *saleService) GetGoodsBySku(partnerId int, itemId int, sku int) *valueobject.Goods {
sl := this._rep.GetSale(partnerId)
var goods sale.IGoods = sl.GetGoodsBySku(itemId, sku)
return goods.GetPackedValue()
}
开发者ID:tonycoming,项目名称:go2o,代码行数:6,代码来源:sale_service.go
示例8: GetItemDescriptionByGoodsId
// 获取货品描述
func (this *saleService) GetItemDescriptionByGoodsId(partnerId, goodsId int) string {
sl := this._rep.GetSale(partnerId)
var goods sale.IGoods = sl.GetGoods(goodsId)
return goods.GetItem().GetValue().Description
}
开发者ID:tonycoming,项目名称:go2o,代码行数:6,代码来源:sale_service.go
注:本文中的go2o/src/core/domain/interface/sale.IGoods类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论