add recorder

This commit is contained in:
Yavolte 2025-06-17 18:33:28 +08:00
parent 7098529421
commit ef4ad92e35
2 changed files with 21 additions and 10 deletions

View File

@ -394,5 +394,9 @@ func Init(ctx context.Context, cbs ...Option) (err error) {
return
}
}
if !opts.disableRecorder {
//启用操作记录
NewActivityRecorder(ctx, opts.db).Recoder()
}
return
}

View File

@ -20,16 +20,17 @@ var (
type (
options struct {
db *gorm.DB
domain string
moduleName string
apiPrefix string //接口前缀
viewPrefix string //生成菜单View的前缀路径
vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件
translate Translate
disableDefault bool
httpServer *http.Server
restOpts []rest.Option
db *gorm.DB
domain string
moduleName string
apiPrefix string //接口前缀
viewPrefix string //生成菜单View的前缀路径
vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件
translate Translate
disableDefault bool
disableRecorder bool
httpServer *http.Server
restOpts []rest.Option
}
Option func(*options)
@ -68,6 +69,12 @@ func WithoutDefault() Option {
}
}
func WithoutRecorder() Option {
return func(o *options) {
o.disableRecorder = true
}
}
func WithHttpServer(server *http.Server) Option {
return func(o *options) {
o.httpServer = server