Esempio n. 1
0
// 三级返现
func (o *subOrderImpl) backFor3R(mch merchant.IMerchant, m member.IMember,
	back_fee float32, unixTime int64) (err error) {
	if back_fee > 0 {
		i := 0
		mName := m.Profile().GetProfile().Name
		saleConf := mch.ConfManager().GetSaleConf()
		percent := saleConf.CashBackTg2Percent
		for i < 2 {
			rl := m.GetRelation()
			if rl == nil || rl.RefereesId == 0 {
				break
			}

			m = o._memberRep.GetMember(rl.RefereesId)
			if m == nil {
				break
			}

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

			err = o.updateMemberAccount(m, mch.GetValue().Name, mName,
				back_fee*percent, unixTime)
			if err != nil {
				domain.HandleError(err, "domain")
				break
			}
			i++
		}
	}
	return err
}
Esempio n. 2
0
// 获取会员汇总信息
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
}
Esempio n. 3
0
// 获取结算数据
func (this *cartImpl) GetSettleData() (s shop.IShop, d member.IDeliverAddress,
	paymentOpt, deliverOpt int) {
	//var err error
	if this._value.ShopId > 0 && this._shop == nil {
		//var pt merchant.IMerchant
		//pt, err = this._partnerRep.GetMerchant(this._merchantId)
		//if err == nil {
		//	this._shop = pt.ShopManager().GetShop(this._value.ShopId)
		//}
		//todo: not implement
	}
	if this._value.DeliverId > 0 && this._deliver == nil {
		var m member.IMember
		m = this._memberRep.GetMember(this._value.BuyerId)
		if m != nil {
			this._deliver = m.Profile().GetDeliver(this._value.DeliverId)
		}
	}
	return this._shop, this._deliver, this._value.PaymentOpt, this._value.DeliverOpt
}
Esempio n. 4
0
// 结算数据持久化
func (this *cartImpl) SettlePersist(shopId, paymentOpt, deliverOpt, deliverId int) error {
	//var shop shop.IShop
	var deliver member.IDeliverAddress
	var err error

	if shopId > 0 {
		//var mch merchant.IMerchant
		//mch, err = this._partnerRep.GetMerchant(this._merchantId)
		//if err != nil {
		//	return err
		//}
		//shop = mch.ShopManager().GetShop(shopId)
		//if shop == nil {
		//	return merchant.ErrNoSuchShop
		//}
		//this._shop = shop
		//this._value.ShopId = shopId

		//todo: not implement
		return err
	}

	if this._value.BuyerId > 0 && deliverId > 0 {
		var m member.IMember = this._memberRep.GetMember(this._value.BuyerId)
		if m == nil {
			return member.ErrNoSuchMember
		}
		deliver = m.Profile().GetDeliver(deliverId)
		if deliver == nil {
			return member.ErrInvalidSession
		}
		this._deliver = deliver
		this._value.DeliverId = deliverId
	}

	this._value.PaymentOpt = paymentOpt
	this._value.DeliverOpt = deliverOpt
	return nil
}