order_log_subscriber.go
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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,
}
}