diff --git a/server/internal/crons/init.go b/server/internal/crons/init.go index a8bec3c..a79698f 100644 --- a/server/internal/crons/init.go +++ b/server/internal/crons/init.go @@ -139,7 +139,6 @@ func RefreshStatus(sysCron *entity.SysCron) (err error) { if sysCron == nil { return } - g.DumpWithType(sysCron) if sysCron.Status == consts.StatusEnabled { return Start(sysCron) diff --git a/server/internal/logic/hook/access_log.go b/server/internal/logic/hook/access_log.go index 704ebce..cbe8a56 100644 --- a/server/internal/logic/hook/access_log.go +++ b/server/internal/logic/hook/access_log.go @@ -18,11 +18,11 @@ import ( // AccessLog 访问日志 func (s *sHook) AccessLog(r *ghttp.Request) { - var ( - ctx = r.Context() - ) + if r.IsFileRequest() { + return + } - // 没有上下文的请求不记录,如:doc、favicon.ico等非功能类业务 + var ctx = r.Context() modelCtx := contexts.Get(ctx) if modelCtx == nil { return diff --git a/server/internal/logic/hook/last_active.go b/server/internal/logic/hook/last_active.go index 8192f96..7f12c94 100644 --- a/server/internal/logic/hook/last_active.go +++ b/server/internal/logic/hook/last_active.go @@ -60,6 +60,10 @@ func allow(memberId int64) bool { // LastActive 更新用户最后活跃 func (s *sHook) LastActive(r *ghttp.Request) { + if r.IsFileRequest() { + return + } + var ( ctx = r.Context() memberId = contexts.GetUserId(ctx) diff --git a/server/internal/logic/sys/cron.go b/server/internal/logic/sys/cron.go index 8378d2f..ed30010 100644 --- a/server/internal/logic/sys/cron.go +++ b/server/internal/logic/sys/cron.go @@ -19,6 +19,7 @@ import ( "hotgo/internal/model/input/form" "hotgo/internal/model/input/sysin" "hotgo/internal/service" + "hotgo/utility/simple" "hotgo/utility/validate" "strings" ) @@ -90,7 +91,10 @@ func (s *sSysCron) Edit(ctx context.Context, in sysin.CronEditInp) (err error) { return err } - return crons.RefreshStatus(&in.SysCron) + simple.SafeGo(ctx, func(ctx context.Context) { + crons.RefreshStatus(&in.SysCron) + }) + return }) return } @@ -136,7 +140,10 @@ func (s *sSysCron) Status(ctx context.Context, in sysin.CronStatusInp) (err erro } models.Status = in.Status - return crons.RefreshStatus(models) + simple.SafeGo(ctx, func(ctx context.Context) { + crons.RefreshStatus(models) + }) + return }) return }