...
|
...
|
@@ -29,6 +29,45 @@ func (subscriber *AbilityServiceSubscriber) HandleEvent(domainEvent domain.Domai |
|
|
}
|
|
|
fmt.Println(data)
|
|
|
break
|
|
|
case event.TASK_CLOSED_EVENT:
|
|
|
taskClosedEvent := domainEvent.(*event.TaskClosed)
|
|
|
var referenceResourceIds []int64
|
|
|
for _, referenceResourceItem := range taskClosedEvent.ReferenceResource.ReferenceResourceItems {
|
|
|
referenceResourceIds = append(referenceResourceIds, referenceResourceItem.ReferenceResourceId)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.CloseTaskCallback(taskClosedEvent.TaskId, referenceResourceIds)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
return err
|
|
|
}
|
|
|
fmt.Println(data)
|
|
|
break
|
|
|
case event.TASK_ROBED_EVENT:
|
|
|
taskRobedEvent := domainEvent.(*event.TaskRobed)
|
|
|
var referenceResourceIds []int64
|
|
|
for _, referenceResourceItem := range taskRobedEvent.ReferenceResource.ReferenceResourceItems {
|
|
|
referenceResourceIds = append(referenceResourceIds, referenceResourceItem.ReferenceResourceId)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.ReceiverTaskCallback(taskRobedEvent.RobInfo.Receiver.Uid, taskRobedEvent.TaskId, referenceResourceIds, taskRobedEvent.RobInfo.Receiver.Uid, taskRobedEvent.RobInfo.ReceiveTime)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
return err
|
|
|
}
|
|
|
fmt.Println(data)
|
|
|
break
|
|
|
case event.TASK_BIDDED_EVENT:
|
|
|
taskBiddedEvent := domainEvent.(*event.TaskBidded)
|
|
|
var referenceResourceIds []int64
|
|
|
for _, referenceResourceItem := range taskBiddedEvent.ReferenceResource.ReferenceResourceItems {
|
|
|
referenceResourceIds = append(referenceResourceIds, referenceResourceItem.ReferenceResourceId)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.ReceiverTaskCallback(taskBiddedEvent.BidInfo.SuccessfulBidder.Uid, taskBiddedEvent.TaskId, referenceResourceIds, taskBiddedEvent.Operator.Uid, taskBiddedEvent.BidInfo.WinBidTime)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
return err
|
|
|
}
|
|
|
fmt.Println(data)
|
|
|
break
|
|
|
case event.TASK_ACCEPTANCED_EVENT:
|
|
|
taskAcceptancedEvent := domainEvent.(*event.TaskAcceptanced)
|
|
|
if taskAcceptancedEvent.ReferenceResource != nil {
|
...
|
...
|
@@ -63,5 +102,8 @@ func (subscriber *AbilityServiceSubscriber) SubscribedToEventTypes() []string { |
|
|
return [] string{
|
|
|
event.TASK_RELEASED_EVENT,
|
|
|
event.TASK_ACCEPTANCED_EVENT,
|
|
|
event.TASK_CLOSED_EVENT,
|
|
|
event.TASK_ROBED_EVENT,
|
|
|
event.TASK_BIDDED_EVENT,
|
|
|
}
|
|
|
} |
...
|
...
|
|