本文整理汇总了Golang中go2o/core/domain/interface/member.IMember.GetAggregateRootId方法的典型用法代码示例。如果您正苦于以下问题:Golang IMember.GetAggregateRootId方法的具体用法?Golang IMember.GetAggregateRootId怎么用?Golang IMember.GetAggregateRootId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go2o/core/domain/interface/member.IMember
的用法示例。
在下文中一共展示了IMember.GetAggregateRootId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetMemberSummary
// 获取会员汇总信息
func (this *memberService) GetMemberSummary(memberId int) *dto.MemberSummary {
var m member.IMember = this._rep.GetMember(memberId)
if m != nil {
mv := m.GetValue()
acv := m.GetAccount().GetValue()
lv := m.GetLevel()
pro := m.Profile().GetProfile()
return &dto.MemberSummary{
Id: m.GetAggregateRootId(),
Usr: mv.Usr,
Name: pro.Name,
Avatar: format.GetResUrl(pro.Avatar),
Exp: mv.Exp,
Level: mv.Level,
LevelName: lv.Name,
Integral: acv.Integral,
Balance: acv.Balance,
PresentBalance: acv.PresentBalance,
GrowBalance: acv.GrowBalance,
GrowAmount: acv.GrowAmount,
GrowEarnings: acv.GrowEarnings,
GrowTotalEarnings: acv.GrowTotalEarnings,
UpdateTime: mv.UpdateTime,
}
}
return nil
}
示例2: applyCoupon
// 应用优惠券
func (this *orderManagerImpl) applyCoupon(m member.IMember, order order.IOrder,
py payment.IPaymentOrder, couponCode string) error {
po := py.GetValue()
cp := this._promRep.GetCouponByCode(
m.GetAggregateRootId(), couponCode)
// 如果优惠券不存在
if cp == nil {
return errors.New("优惠券无效")
}
// 获取优惠券
coupon := cp.(promotion.ICouponPromotion)
result, err := coupon.CanUse(m, po.TotalFee)
if result {
if coupon.CanTake() {
_, err = coupon.GetTake(m.GetAggregateRootId())
//如果未占用,则占用
if err != nil {
err = coupon.Take(m.GetAggregateRootId())
}
} else {
_, err = coupon.GetBind(m.GetAggregateRootId())
}
if err != nil {
domain.HandleError(err, "domain")
err = errors.New("优惠券无效")
} else {
//应用优惠券
if err = order.ApplyCoupon(coupon); err == nil {
_, err = py.CouponDiscount(coupon)
}
}
}
return err
}
示例3: createPaymentOrder
// 生成支付单
func (this *orderManagerImpl) createPaymentOrder(m member.IMember,
o order.IOrder) payment.IPaymentOrder {
val := o.GetValue()
v := &payment.PaymentOrderBean{
BuyUser: m.GetAggregateRootId(),
PaymentUser: m.GetAggregateRootId(),
VendorId: 0,
OrderId: 0,
// 支付单金额
TotalFee: val.FinalAmount,
// 余额抵扣
BalanceDiscount: 0,
// 积分抵扣
IntegralDiscount: 0,
// 系统支付抵扣金额
SystemDiscount: 0,
// 优惠券金额
CouponDiscount: 0,
// 立减金额
SubFee: 0,
// 支付选项
PaymentOpt: payment.OptPerm,
// 支付方式
PaymentSign: enum.PaymentOnlinePay,
//创建时间
CreateTime: time.Now().Unix(),
// 在线支付的交易单号
OuterNo: "",
//支付时间
PaidTime: 0,
// 状态: 0为未付款,1为已付款,2为已取消
State: payment.StateNotYetPayment,
}
v.FinalFee = v.TotalFee - v.SubFee - v.SystemDiscount -
v.IntegralDiscount - v.BalanceDiscount
return this._payRep.CreatePaymentOrder(v)
}