You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/internal/servants/chain/events.go

36 lines
812 B

// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package chain
import (
"github.com/alimy/tryst/event"
"github.com/rocboss/paopao-ce/internal/events"
"github.com/rocboss/paopao-ce/internal/model/web"
"github.com/sirupsen/logrus"
)
type AuditHookEvent struct {
event.UnimplementedEvent
ami *web.AuditMetaInfo
}
func (e *AuditHookEvent) Name() string {
return "AuditHookEvent"
}
func (e *AuditHookEvent) Action() error {
// TODO: just log event now will add real logic in future.
logrus.Debugf("auditHook event action style[%s] id[%d]", e.ami.Style, e.ami.Id)
return nil
}
func OnAudiotHookEvent(ami *web.AuditMetaInfo) {
if ami != nil {
events.OnEvent(&AuditHookEvent{
ami: ami,
})
}
}