• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang member.IMember类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中go2o/src/core/domain/interface/member.IMember的典型用法代码示例。如果您正苦于以下问题:Golang IMember类的具体用法?Golang IMember怎么用?Golang IMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IMember类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: backFor3R

// 三级返现
func (this *Order) backFor3R(pt partner.IPartner, m member.IMember,
	back_fee float32, unixTime int64) {
	if back_fee == 0 {
		return
	}

	i := 0
	mName := m.GetValue().Name
	saleConf := pt.GetSaleConf()
	percent := saleConf.CashBackTg2Percent
	for i < 2 {
		rl := m.GetRelation()
		if rl == nil || rl.InvitationMemberId == 0 {
			break
		}

		m = this._memberRep.GetMember(rl.InvitationMemberId)
		if m == nil {
			break
		}

		if i == 1 {
			percent = saleConf.CashBackTg1Percent
		}

		this.updateMemberAccount(m, pt.GetValue().Name, mName,
			back_fee*percent, unixTime)
		i++
	}
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:31,代码来源:order.go


示例2: CanUse

// 是否可用
func (this *Coupon) CanUse(m member.IMember, fee float32) (bool, error) {
	mv := m.GetValue()
	cv := this.GetValue()

	if cv.AllowEnable == 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
}
开发者ID:honj51,项目名称:go2o,代码行数:36,代码来源:coupon.go


示例3: 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
}
开发者ID:zoe527,项目名称:go2o,代码行数:32,代码来源:order.go


示例4: updateMemberAccount

func (this *Order) updateMemberAccount(m member.IMember,
	ptName, mName string, fee float32, unixTime int64) {
	if fee == 0 {
		return
	}

	//更新账户
	acc := m.GetAccount()
	acv := acc.GetValue()
	acv.PresentBalance += fee
	acv.TotalPresentFee += fee
	acv.UpdateTime = unixTime
	acc.Save()

	//给自己返现
	icLog := &member.IncomeLog{
		MemberId: this._value.MemberId,
		Type:     "backcash",
		Fee:      fee,
		Log: fmt.Sprintf("订单:%s(商家:%s,会员:%s)收入¥%.2f元",
			this._value.OrderNo, ptName, mName, fee),
		State:      1,
		RecordTime: unixTime,
	}
	m.SaveIncomeLog(icLog)
}
开发者ID:jacobxk,项目名称:go2o,代码行数:26,代码来源:order.go


示例5: updateShoppingMemberBackFee

// 更新返现到会员账户
func (this *Order) updateShoppingMemberBackFee(pt partner.IPartner,
	m member.IMember, fee float32, unixTime int64) {
	if fee == 0 {
		return
	}
	v := this.GetValue()
	pv := pt.GetValue()

	//更新账户
	acc := m.GetAccount()
	acv := acc.GetValue()
	//acc.TotalFee += this._value.Fee
	//acc.TotalPay += this._value.PayFee
	acv.PresentBalance += fee // 更新赠送余额
	acv.TotalPresentFee += fee
	acv.UpdateTime = unixTime
	acc.Save()

	//给自己返现
	icLog := &member.IncomeLog{
		MemberId:   this._value.MemberId,
		OrderId:    v.Id,
		Type:       "backcash",
		Fee:        fee,
		Log:        fmt.Sprintf("订单:%s(商家:%s)返现¥%.2f元", v.OrderNo, pv.Name, fee),
		State:      1,
		RecordTime: unixTime,
	}
	m.SaveIncomeLog(icLog)
}
开发者ID:jacobxk,项目名称:go2o,代码行数:31,代码来源:order.go


示例6: updateAccountForOrder

// 更新账户
func updateAccountForOrder(m member.IMember, order shopping.IOrder) {
	acc := m.GetAccount()
	ov := order.GetValue()
	acc.TotalFee += ov.Fee
	acc.TotalPay += ov.PayFee
	acc.UpdateTime = time.Now().Unix()
	m.SaveAccount()
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:9,代码来源:order.go


示例7: cashBack3R

func cashBack3R(m member.IMember, order *shopping.ValueOrder, c promotion.ICashBackPromotion, memberRep member.IMemberRep) {

	var fee1 int
	var fee2 int

	dt := c.GetDataTag()
	fee1, _ = strconv.Atoi(dt["G1"])
	fee2, _ = strconv.Atoi(dt["G2"])

	var cm member.IMember = m
	var pm member.IMember = m

	// fmt.Println("------ START BACK ------")

	var backFunc = func(m member.IMember, parentM member.IMember, fee int) {
		// fmt.Println("---------[ back ]",parentM.GetValue().Name,fee)
		backCashForMember(m, order, fee, parentM.GetValue().Name)
	}
	var i int = 0
	for true {
		rl := cm.GetRelation()
		// fmt.Println("-------- BACK - ID - ",rl.InvitationMemberId)
		if rl == nil || rl.InvitationMemberId == 0 {
			break
		}

		cm = memberRep.GetMember(rl.InvitationMemberId)

		// fmt.Println("-------- BACK ",cm == nil)
		if m == nil {
			break
		}

		if i == 0 {
			backFunc(cm, pm, fee2)
		} else if i == 1 {
			backFunc(cm, pm, fee1)
		}

		pm = cm

		i++
		if i > 1 {
			break
		}
	}
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:47,代码来源:cash_back.go


示例8: GetSettleData

// 获取结算数据
func (this *Cart) GetSettleData() (s partner.IShop, d member.IDeliver, paymentOpt, deliverOpt int) {
	var err error
	if this.value.ShopId > 0 && this._shop == nil {
		var pt partner.IPartner
		pt, err = this.partnerRep.GetPartner(this.partnerId)
		if err == nil {
			this._shop = pt.GetShop(this.value.ShopId)
		}
	}
	if this.value.DeliverId > 0 && this._deliver == nil {
		var m member.IMember
		m, err = this.memberRep.GetMember(this.value.BuyerId)
		if err == nil {
			this._deliver = m.GetDeliver(this.value.DeliverId)
		}
	}
	return this._shop, this._deliver, this.value.PaymentOpt, this.value.DeliverOpt
}
开发者ID:honj51,项目名称:go2o,代码行数:19,代码来源:cart.go


示例9: backCashForMember

func backCashForMember(m member.IMember, order *shopping.ValueOrder,
	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
}
开发者ID:zoe527,项目名称:go2o,代码行数:18,代码来源:cash_back.go


示例10: updateMemberAccount

func (this *Order) updateMemberAccount(m member.IMember,
	ptName, mName string, fee float32, unixTime int64) {
	if fee == 0 {
		return
	}

	//更新账户
	acc := m.GetAccount()
	acv := acc.GetValue()
	acv.PresentBalance += fee
	acv.TotalPresentFee += fee
	acv.UpdateTime = unixTime
	acc.Save()

	//给自己返现
	tit := fmt.Sprintf("订单:%s(商家:%s,会员:%s)收入¥%.2f元",
		this._value.OrderNo, ptName, mName, fee)
	acc.PresentBalance(tit, this._value.OrderNo, fee)
}
开发者ID:zoe527,项目名称:go2o,代码行数:19,代码来源:order.go


示例11: cashBack3R

func cashBack3R(level int, m member.IMember, order *shopping.ValueOrder, c promotion.ICashBackPromotion, memberRep member.IMemberRep) {

	dt := c.GetDataTag()

	var cm member.IMember = m
	var pm member.IMember = m

	// fmt.Println("------ START BACK ------")

	var backFunc = func(m member.IMember, parentM member.IMember, fee int) {
		// fmt.Println("---------[ back ]",parentM.GetValue().Name,fee)
		backCashForMember(m, order, fee, parentM.GetValue().Name)
	}
	var i int = 0
	for true {
		rl := cm.GetRelation()
		// fmt.Println("-------- BACK - ID - ",rl.InvitationMemberId)
		if rl == nil || rl.RefereesId == 0 {
			break
		}

		cm = memberRep.GetMember(rl.RefereesId)

		// fmt.Println("-------- BACK ",cm == nil)
		if m == nil {
			break
		}

		if fee, err := strconv.Atoi(dt[fmt.Sprintf("G%d", i)]); err == nil {
			//log.Println("[ Back][ Cash] - ",i," back ",fee)
			backFunc(cm, pm, fee)
		}

		pm = cm

		i++
		if i >= level {
			break
		}
	}
}
开发者ID:jackyan,项目名称:go2o,代码行数:41,代码来源:cash_back.go


示例12: backCashForMember

func backCashForMember(m member.IMember, order *shopping.ValueOrder, 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 {
		//给自己返现
		icLog := &member.IncomeLog{
			MemberId:   m.GetAggregateRootId(),
			OrderId:    order.Id,
			Type:       "backcash",
			Fee:        float32(fee),
			Log:        fmt.Sprintf("推广返现¥%s元,订单号:%s,来源:%s", format.FormatFloat(bFee), order.OrderNo, refName),
			State:      1,
			RecordTime: acv.UpdateTime,
		}
		err = m.SaveIncomeLog(icLog)
	}
	return err
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:25,代码来源:cash_back.go


示例13: 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
}
开发者ID:sunxboy,项目名称:go2o,代码行数:35,代码来源:order.go


示例14: updateShoppingMemberBackFee

// 更新返现到会员账户
func (this *Order) updateShoppingMemberBackFee(pt partner.IPartner,
	m member.IMember, fee float32, unixTime int64) {
	if fee == 0 {
		return
	}
	v := this.GetValue()
	pv := pt.GetValue()

	//更新账户
	acc := m.GetAccount()
	acv := acc.GetValue()
	//acc.TotalFee += this._value.Fee
	//acc.TotalPay += this._value.PayFee
	acv.PresentBalance += fee // 更新赠送余额
	acv.TotalPresentFee += fee
	acv.UpdateTime = unixTime
	acc.Save()

	//给自己返现
	tit := fmt.Sprintf("订单:%s(商家:%s)返现¥%.2f元", v.OrderNo, pv.Name, fee)
	acc.PresentBalance(tit, v.OrderNo, float32(fee))
}
开发者ID:zoe527,项目名称:go2o,代码行数:23,代码来源:order.go


示例15: SettlePersist

// 结算数据持久化
func (this *Cart) SettlePersist(shopId, paymentOpt, deliverOpt, deliverId int) error {
	var shop partner.IShop
	var deliver member.IDeliver
	var err error

	if shopId > 0 {
		var pt partner.IPartner
		pt, err = this._partnerRep.GetPartner(this._partnerId)
		if err != nil {
			return err
		}
		shop = pt.GetShop(shopId)
		if shop == nil {
			return partner.ErrNoSuchShop
		}
		this._shop = shop
		this._value.ShopId = shopId
	}

	if this._value.BuyerId > 0 && deliverId > 0 {
		var m member.IMember
		m, err = this._memberRep.GetMember(this._value.BuyerId)
		if err != nil {
			return err
		}
		deliver = m.GetDeliver(deliverId)
		fmt.Println("-----", m.GetAggregateRootId(), deliverId)
		if deliver == nil {
			return member.ErrInvalidSession
		}
		this._deliver = deliver
		this._value.DeliverId = deliverId
	}

	this._value.PaymentOpt = paymentOpt
	this._value.DeliverOpt = deliverOpt
	return nil
}
开发者ID:sunxboy,项目名称:go2o,代码行数:39,代码来源:cart.go


示例16: GetMemberSummary

// 获取会员汇总信息
func (this *memberService) GetMemberSummary(memberId int) *dto.MemberSummary {
	var m member.IMember = this._memberRep.GetMember(memberId)
	if m != nil {
		mv := m.GetValue()
		acv := m.GetAccount().GetValue()
		lv := m.GetLevel()
		return &dto.MemberSummary{
			Id:             m.GetAggregateRootId(),
			Usr:            mv.Usr,
			Name:           mv.Name,
			Exp:            mv.Exp,
			Level:          mv.Level,
			LevelName:      lv.Name,
			Integral:       acv.Integral,
			Balance:        acv.Balance,
			PresentBalance: acv.PresentBalance,
			UpdateTime:     mv.UpdateTime,
		}
	}
	return nil
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:22,代码来源:member_service.go



注:本文中的go2o/src/core/domain/interface/member.IMember类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang member.ValueMember类代码示例发布时间:2022-05-28
下一篇:
Golang member.DeliverAddress类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap