From b76ff92f77f135924bec14a783c953bbf4be85c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=BB=8B=E6=B6=A6?= <807046079@qq.com> Date: Mon, 11 Nov 2024 10:51:50 +0800 Subject: [PATCH] execute getToken when service enabled --- service/thirdparty/email/enter.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/service/thirdparty/email/enter.go b/service/thirdparty/email/enter.go index a83aa21..e25e649 100644 --- a/service/thirdparty/email/enter.go +++ b/service/thirdparty/email/enter.go @@ -2,6 +2,7 @@ package email import ( "fmt" + "github.com/ZiRunHua/LeapLedger/global/cron" ) @@ -43,7 +44,14 @@ func (e *thirdPartyResponseError) Error() string { func init() { _, err := cron.Scheduler.Every(30).Minute().Do( - cron.MakeJobFunc(Service.getToken), + cron.MakeJobFunc( + func() error { + if false == ServiceStatus { + return nil + } + return Service.getToken() + }, + ), ) if err != nil { panic(err)