优化结构
This commit is contained in:
@@ -3,8 +3,8 @@ package worker
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"kra/internal/biz/system"
|
||||
|
||||
"kra/internal/biz"
|
||||
"kra/internal/conf"
|
||||
platformtask "kra/pkg/task"
|
||||
)
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
// TaskMethods is the system module's dependency-bearing task contribution.
|
||||
// Other modules provide their own contributor instead of editing this file.
|
||||
type TaskMethods struct {
|
||||
tasks *biz.TaskUsecase
|
||||
media *biz.MediaUsecase
|
||||
tasks *system.TaskUsecase
|
||||
media *system.MediaUsecase
|
||||
runtime *conf.Runtime
|
||||
}
|
||||
|
||||
func NewTaskMethods(tasks *biz.TaskUsecase, media *biz.MediaUsecase, runtime *conf.Runtime) *TaskMethods {
|
||||
func NewTaskMethods(tasks *system.TaskUsecase, media *system.MediaUsecase, runtime *conf.Runtime) *TaskMethods {
|
||||
return &TaskMethods{tasks: tasks, media: media, runtime: runtime}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ func (methods *TaskMethods) RegisterTasks(registry *platformtask.Registry) {
|
||||
return
|
||||
}
|
||||
registry.Register(platformtask.Method{
|
||||
Name: biz.TaskMethodClearDB, Description: "清理数据库过期日志(操作记录/JWT黑名单/定时任务执行日志)", Run: func(ctx context.Context, _ json.RawMessage) error {
|
||||
Name: system.TaskMethodClearDB, Description: "清理数据库过期日志(操作记录/JWT黑名单/定时任务执行日志)", Run: func(ctx context.Context, _ json.RawMessage) error {
|
||||
return methods.tasks.CleanupLogs(ctx)
|
||||
},
|
||||
})
|
||||
registry.Register(platformtask.Method{
|
||||
Name: biz.TaskMethodUploads, Description: "清理过期大文件上传会话", Run: func(ctx context.Context, _ json.RawMessage) error {
|
||||
Name: system.TaskMethodUploads, Description: "清理过期大文件上传会话", Run: func(ctx context.Context, _ json.RawMessage) error {
|
||||
ttl := 24
|
||||
config := methods.runtime.Admin()
|
||||
if config != nil && config.Media != nil && config.Media.SessionTtl > 0 {
|
||||
|
||||
Reference in New Issue
Block a user