feat: 重构守护入口逻辑

This commit is contained in:
Mmx
2021-09-19 20:54:23 +08:00
parent b148eea874
commit 334f5bbcf0
4 changed files with 12 additions and 17 deletions

13
main.go
View File

@@ -4,23 +4,20 @@ import (
"autoLogin/controllers"
"autoLogin/global"
"autoLogin/util"
"os"
)
func main() {
defer util.Log.CatchRecover()
if err := controllers.Login(true); err != nil {
if global.Config.Settings.Guardian != 0 {
controllers.EnterGuardian()
} else if err := controllers.Login(true); err != nil {
util.Log.Println("运行出错,状态异常")
if global.Config.Settings.ForceGuardianEvenFailed {
util.Log.Println(err)
} else if global.Config.Settings.DemoMode {
if global.Config.Settings.DemoMode {
util.Log.Fatalln(err)
} else {
util.Log.Println(err)
os.Exit(3)
return
}
}
controllers.EnterGuardian()
}