From a0f367efebcf7540bd07c765a1be1632cbda58e6 Mon Sep 17 00:00:00 2001 From: ayflying Date: Thu, 30 Oct 2025 18:19:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E5=A4=A9=E5=87=8C=E6=99=A8=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=A3=80=E6=B5=8B=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/system/system.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/logic/system/system.go b/internal/logic/system/system.go index e901047..51cbb43 100644 --- a/internal/logic/system/system.go +++ b/internal/logic/system/system.go @@ -1,8 +1,11 @@ package system import ( + "context" + "github.com/ayflying/p2p/internal/service" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcron" "github.com/gogf/gf/v2/os/gctx" ) @@ -17,6 +20,14 @@ func init() { getDev, _ := g.Cfg().GetWithEnv(gctx.New(), "dev") if !getDev.Bool() { + // 每天0点检查更新 + gcron.Add(gctx.New(), "0 0 0 * * *", func(ctx context.Context) { + err := service.System().CheckUpdate() + if err != nil { + g.Log().Errorf(ctx, "检查更新失败:%v", err) + } + }) + err := service.System().CheckUpdate() if err != nil { g.Log().Errorf(gctx.New(), "检查更新失败:%v", err)