order_log_subscriber.go 1.1 KB
package subscriber

import (
	"github.com/linmadan/egglib-go/core/domain"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain/event"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
)

//订单数据修改触发的订阅事件
type OrderLogSubscriber struct {
	transactionContext *transaction.TransactionContext
}

var _ domain.DomainEventSubscriber = (*OrderLogSubscriber)(nil)

func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent domain.DomainEvent) error {
	switch domainEvent.EventType() {
	//订单分红因为货品的数量变动而发送改变
	case event.UPDATE_BONUS_BY_GOOD_NUMBER_EVENT:
	//订单分红因为合伙人分红比例变动而发送改变
	case event.UPDATE_BONUS_BY_PARTENT_BONUS_PERCENT_EVENT:
	//更新订单的备注
	case event.UPDATE_ORDER_REMARK:
	// 支付订单中货品的分红
	case event.PAY_ORDER_GOOD_BONUS_EVENT:
	}
	return nil
}

func (subscriber *OrderLogSubscriber) SubscribedToEventTypes() []string {
	return []string{
		event.UPDATE_BONUS_BY_GOOD_NUMBER_EVENT,
		event.UPDATE_BONUS_BY_PARTENT_BONUS_PERCENT_EVENT,
		event.UPDATE_ORDER_REMARK,
		event.PAY_ORDER_GOOD_BONUS_EVENT,
	}
}