本文整理汇总了Golang中go2o/core/domain/interface/member.IMember.GetValue方法的典型用法代码示例。如果您正苦于以下问题:Golang IMember.GetValue方法的具体用法?Golang IMember.GetValue怎么用?Golang IMember.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go2o/core/domain/interface/member.IMember
的用法示例。
在下文中一共展示了IMember.GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CanUse
// 是否可用
func (this *Coupon) CanUse(m member.IMember, fee float32) (bool, error) {
mv := m.GetValue()
cv := this.GetDetailsValue()
if this._value.Enabled == 0 {
return false, errors.New("无效的优惠券")
}
dtUnix := time.Now().Unix()
stUnix := cv.BeginTime
ovUnix := cv.OverTime
if dtUnix < stUnix {
return false, errors.New(fmt.Sprintf("优惠券必须在%s~%s使用",
time.Unix(cv.BeginTime, 0).Format("2006-01-02"),
time.Unix(cv.OverTime, 0).Format("2006-01-02")),
)
} else if dtUnix > ovUnix {
return false, errors.New("优惠拳已过期")
}
if cv.NeedBind == 0 && cv.Amount == 0 {
return false, errors.New("优惠券不足")
}
if mv.Level < cv.MinLevel {
return false, errors.New("会员等级不满足要求")
}
if fee < float32(cv.MinFee) {
return false, errors.New(fmt.Sprintf("订单金额需达到¥%d", cv.MinFee))
}
return true, nil
}