本文整理汇总了Golang中go2o/src/core/domain/interface/shopping.OrderPromotionBind类的典型用法代码示例。如果您正苦于以下问题:Golang OrderPromotionBind类的具体用法?Golang OrderPromotionBind怎么用?Golang OrderPromotionBind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrderPromotionBind类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleCashBackPromotion
// 处理返现促销
func (this *Order) handleCashBackPromotion(pt partner.IPartner, m member.IMember,
v *shopping.OrderPromotionBind, pm promotion.IPromotion) error {
cpv := pm.GetRelationValue().(*promotion.ValueCashBack)
//更新账户
bFee := float32(cpv.BackFee)
acc := m.GetAccount()
acv := acc.GetValue()
acv.PresentBalance += bFee // 更新赠送余额
acv.TotalPresentFee += bFee
// 赠送金额,不应该计入到余额,可采取充值到余额
//acc.Balance += float32(cpv.BackFee) // 更新账户余额
acv.UpdateTime = time.Now().Unix()
_, err := acc.Save()
if err == nil {
// 优惠绑定生效
v.IsApply = 1
this._shoppingRep.SavePromotionBindForOrder(v)
// 处理自定义返现
c := pm.(promotion.ICashBackPromotion)
HandleCashBackDataTag(m, this._value, c, this._memberRep)
//给自己返现
tit := fmt.Sprintf("返现¥%d元,订单号:%s", cpv.BackFee, this._value.OrderNo)
err = acc.PresentBalance(tit, v.OrderNo, float32(cpv.BackFee))
}
return err
}
示例2: handleCashBackPromotion
// 处理返现促销
func (this *Order) handleCashBackPromotion(pt partner.IPartner, m member.IMember,
v *shopping.OrderPromotionBind, pm promotion.IPromotion) error {
cpv := pm.GetRelationValue().(*promotion.ValueCashBack)
//更新账户
acc := m.GetAccount()
acc.PresentBalance = acc.PresentBalance + float32(cpv.BackFee) // 更新赠送余额
acc.Balance += float32(cpv.BackFee) // 更新账户余额
acc.UpdateTime = time.Now().Unix()
err := m.SaveAccount()
if err == nil {
// 优惠绑定生效
v.IsApply = 1
this._shoppingRep.SavePromotionBindForOrder(v)
// 处理自定义返现
c := pm.(promotion.ICashBackPromotion)
HandleCashBackDataTag(m, this._value, c, this._memberRep)
//给自己返现
icLog := &member.IncomeLog{
MemberId: this._value.MemberId,
OrderId: this.GetDomainId(),
Type: "backcash",
Fee: float32(cpv.BackFee),
Log: fmt.Sprintf("返现¥%d元,订单号:%s", cpv.BackFee, this._value.OrderNo),
State: 1,
RecordTime: acc.UpdateTime,
}
err = m.SaveIncomeLog(icLog)
}
return err
}