本文整理汇总了Golang中go2o/core/domain/interface/member.IMember.GetAccount方法的典型用法代码示例。如果您正苦于以下问题:Golang IMember.GetAccount方法的具体用法?Golang IMember.GetAccount怎么用?Golang IMember.GetAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go2o/core/domain/interface/member.IMember
的用法示例。
在下文中一共展示了IMember.GetAccount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: handleCashBackPromotion
// 处理返现促销
func (o *orderImpl) handleCashBackPromotion(pt merchant.IMerchant,
m member.IMember,
v *order.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
o._orderRep.SavePromotionBindForOrder(v)
// 处理自定义返现
c := pm.(promotion.ICashBackPromotion)
HandleCashBackDataTag(m, o._value, c, o._memberRep)
//给自己返现
tit := fmt.Sprintf("返现¥%d元,订单号:%s", cpv.BackFee, o._value.OrderNo)
err = acc.PresentBalance(tit, o.GetOrderNo(), float32(cpv.BackFee))
}
return err
}
示例3: backCashForMember
func backCashForMember(m member.IMember, order *order.Order,
fee int, refName string) error {
//更新账户
acc := m.GetAccount()
acv := acc.GetValue()
bFee := float32(fee)
acv.PresentBalance += bFee // 更新赠送余额
acv.TotalPresentFee += bFee
acv.UpdateTime = time.Now().Unix()
_, err := acc.Save()
if err == nil {
tit := fmt.Sprintf("推广返现¥%s元,订单号:%s,来源:%s",
format.FormatFloat(bFee), order.OrderNo, refName)
err = acc.PresentBalance(tit, order.OrderNo, float32(fee))
}
return err
}
示例4: updateMemberAccount
func (o *subOrderImpl) updateMemberAccount(m member.IMember,
ptName, mName string, fee float32, unixTime int64) error {
if fee > 0 {
//更新账户
acc := m.GetAccount()
acv := acc.GetValue()
acv.PresentBalance += fee
acv.TotalPresentFee += fee
acv.UpdateTime = unixTime
_, err := acc.Save()
if err == nil {
//给自己返现
tit := fmt.Sprintf("订单:%s(商户:%s,会员:%s)收入¥%.2f元",
o._value.OrderNo, ptName, mName, fee)
err = acc.PresentBalance(tit, o._value.OrderNo, fee)
}
return err
}
return nil
}
示例5: updateShoppingMemberBackFee
// 更新返现到会员账户
func (o *subOrderImpl) updateShoppingMemberBackFee(mchName string,
m member.IMember, fee float32, unixTime int64) error {
if fee > 0 {
v := o.GetValue()
//更新账户
acc := m.GetAccount()
acv := acc.GetValue()
//acc.TotalFee += o._value.Fee
//acc.TotalPay += o._value.PayFee
acv.PresentBalance += fee // 更新赠送余额
acv.TotalPresentFee += fee
acv.UpdateTime = unixTime
acc.Save()
//给自己返现
tit := fmt.Sprintf("订单:%s(商户:%s)返现¥%.2f元", v.OrderNo, mchName, fee)
return acc.PresentBalance(tit, v.OrderNo, float32(fee))
}
return nil
}
示例6: updateAccountForOrder
// 更新账户
func (o *subOrderImpl) updateAccountForOrder(m member.IMember) error {
if o._value.State != order.StatCompleted {
return order.ErrUnusualOrderStat
}
var err error
ov := o._value
conf := o._valRep.GetGlobNumberConf()
amount := ov.FinalAmount
acc := m.GetAccount()
// 增加经验
rate := conf.ExperienceRateByOrder
if exp := int(amount * rate); exp > 0 {
if err = m.AddExp(exp); err != nil {
return err
}
}
// 增加积分
//todo: 增加阶梯的返积分,比如订单满30送100积分
integral := int(amount*conf.IntegralRateByOrder) + conf.IntegralBackExtra
// 赠送积分
if integral > 0 {
err = m.GetAccount().AddIntegral(ov.VendorId, enum.INTEGRAL_TYPE_ORDER,
integral, fmt.Sprintf("订单返积分%d个", integral))
if err != nil {
return err
}
}
acv := acc.GetValue()
acv.TotalFee += ov.GoodsAmount
acv.TotalPay += ov.FinalAmount
acv.UpdateTime = time.Now().Unix()
_, err = acc.Save()
return err
}