From 7eda5dc7e67751536dc74bfa92a86b3376d7958f Mon Sep 17 00:00:00 2001 From: zggsong Date: Thu, 3 Nov 2022 21:05:42 +0800 Subject: [PATCH] feat: Separate declaration and refresh access control --- config/config.go | 1 + model/model.go | 1 + serve/serve.go | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 6e82e3d..d4e1312 100644 --- a/config/config.go +++ b/config/config.go @@ -41,6 +41,7 @@ func InitialConfig() model.Config { func getConfig() model.Config { var config model.Config + config.RefreshDoor = viper.GetBool("server.refresh_door") config.Quality = viper.GetString("images.quality") config.UserName = viper.GetString("user.username") config.PassWord = viper.GetString("user.password") diff --git a/model/model.go b/model/model.go index 510c6ad..59ed68f 100644 --- a/model/model.go +++ b/model/model.go @@ -75,6 +75,7 @@ type BarkResp struct { // @Description: config model // type Config struct { + RefreshDoor bool Quality string UserName string PassWord string diff --git a/serve/serve.go b/serve/serve.go index 92ee3c6..9ba7ae9 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -141,7 +141,11 @@ func DeclarationService(files map[string]string) { } log.Infof("每日申报成功") + util.SendSuccess("【成功】每日申报") + if !global.GLO_CONFIG.RefreshDoor { + return + } //刷新门禁 for i := 0; i < 3; i++ { err = core.RefreshDoor(auth, __user__) @@ -154,8 +158,7 @@ func DeclarationService(files map[string]string) { } } log.Infof("刷新门禁成功") - - util.SendSuccess("【成功】每日申报、刷新门禁") + util.SendSuccess("【成功】刷新门禁") } //