2022-11-24 23:37:34 +08:00
|
|
|
// Package hook
|
|
|
|
// @Link https://github.com/bufanyun/hotgo
|
2023-02-23 17:53:04 +08:00
|
|
|
// @Copyright Copyright (c) 2023 HotGo CLI
|
2022-11-24 23:37:34 +08:00
|
|
|
// @Author Ms <133814250@qq.com>
|
|
|
|
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
|
|
|
package hook
|
|
|
|
|
|
|
|
import (
|
2023-02-23 17:53:04 +08:00
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
2022-11-24 23:37:34 +08:00
|
|
|
"hotgo/internal/service"
|
|
|
|
)
|
|
|
|
|
|
|
|
type sHook struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
service.RegisterHook(New())
|
|
|
|
}
|
|
|
|
|
|
|
|
func New() *sHook {
|
|
|
|
return &sHook{}
|
|
|
|
}
|
2023-02-23 17:53:04 +08:00
|
|
|
|
2023-05-10 23:54:50 +08:00
|
|
|
func (s *sHook) BeforeServe(r *ghttp.Request) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-02-23 17:53:04 +08:00
|
|
|
func (s *sHook) AfterOutput(r *ghttp.Request) {
|
|
|
|
s.accessLog(r)
|
|
|
|
s.lastAdminActive(r)
|
|
|
|
}
|