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/audit.go

26 lines
611 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/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/model/web"
)
func AuditHook() gin.HandlerFunc {
return func(c *gin.Context) {
// 此midleware后面是真正的http handlder让handler先执行
c.Next()
// 审核hook 后处理逻辑
var ami *web.AuditMetaInfo
if val, ok := c.Get(web.AuditHookCtxKey); ok {
if ami, ok = val.(*web.AuditMetaInfo); !ok {
return
}
}
OnAudiotHookEvent(ami)
}
}