feat:支持后台模式与网络守护

This commit is contained in:
Mmx
2021-07-11 12:52:56 +08:00
parent e3f668c100
commit 257a9b7034
8 changed files with 192 additions and 86 deletions

21
controllers/guardian.go Normal file
View File

@@ -0,0 +1,21 @@
package controllers
import (
"Mmx/global"
"Mmx/util"
"time"
)
func Guardian() {
for {
time.Sleep(time.Duration(global.Config.Settings.Guardian) * time.Second)
go func() {
defer func() {
_ = recover()
}()
if !util.Checker.NetOk() {
Login(false)
}
}()
}
}