feat:支持后台模式与网络守护
This commit is contained in:
21
controllers/guardian.go
Normal file
21
controllers/guardian.go
Normal 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)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user