本文整理汇总了Golang中go2o/src/core/domain/interface/promotion.IPromotion.Save方法的典型用法代码示例。如果您正苦于以下问题:Golang IPromotion.Save方法的具体用法?Golang IPromotion.Save怎么用?Golang IPromotion.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go2o/src/core/domain/interface/promotion.IPromotion
的用法示例。
在下文中一共展示了IPromotion.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SavePromotion
// 保存促销
func (this *promotionService) SavePromotion(v *promotion.ValuePromotion) (int, error) {
var prom promotion.IPromotion
if v.Id > 0 {
prom = this._newRep.GetPromotion(v.Id)
prom.SetValue(v)
} else {
prom = this._newRep.CreatePromotion(v)
}
return prom.Save()
}
示例2: SavePromotion
// 保存促销
func (this *promotionService) SavePromotion(v *promotion.ValuePromotion) (int, error) {
var prom promotion.IPromotion
if v.Id > 0 {
prom = this._rep.GetPromotion(v.Id)
err := prom.SetValue(v)
if err != nil {
return v.Id, err
}
} else {
prom = this._rep.CreatePromotion(v)
}
return prom.Save()
}
示例3: SaveCashBackPromotion
func (this *promotionService) SaveCashBackPromotion(partnerId int, v *promotion.ValuePromotion,
v1 *promotion.ValueCashBack) (int, error) {
var prom promotion.IPromotion
if v.Id > 0 {
prom = this._newRep.GetPromotion(v.Id)
if prom.GetValue().PartnerId != partnerId {
return -1, partner.ErrNotMatch
}
prom.SetValue(v)
} else {
prom = this._newRep.CreatePromotion(v)
}
cb := prom.(promotion.ICashBackPromotion)
if err := cb.SetDetailsValue(v1); err != nil {
return v.Id, err
}
return prom.Save()
}
示例4: SaveCoupon
/************** Coupon ************/
func (this *promotionService) SaveCoupon(partnerId int, v *promotion.ValuePromotion, v1 *promotion.ValueCoupon) (int, error) {
var prom promotion.IPromotion
var err error
if v.Id > 0 {
prom = this._rep.GetPromotion(v.Id)
if prom.GetValue().PartnerId != partnerId {
return -1, partner.ErrNotMatch
}
} else {
prom = this._rep.CreatePromotion(v)
}
if err = prom.SetValue(v); err == nil {
cb := prom.(promotion.ICouponPromotion)
err = cb.SetDetailsValue(v1)
}
if err != nil {
return v.Id, err
}
return prom.Save()
}