代码拉取完成,页面将自动刷新
package users
import (
"github.com/gin-gonic/gin"
"goskeleton/app/global/consts"
"goskeleton/app/global/variable"
)
// 模拟Aop 实现对某个控制器函数的前置和后置回调
type DestroyBefore struct{}
// 前置函数必须具有返回值,这样才能控制流程是否继续向下执行
func (d *DestroyBefore) Before(context *gin.Context) bool {
userId := context.GetFloat64(consts.ValidatorPrefix + "id")
variable.ZapLog.Sugar().Infof("模拟 Users 删除操作, Before 回调,用户ID:%.f\n", userId)
if userId > 10 {
return true
} else {
return false
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。