From e722ffb5a5e8324e9717ca7b161e49d02ea31112 Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Thu, 14 Nov 2024 13:37:42 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20telegram?= =?UTF-8?q?=5Fbot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + bin/date.txt | 2 +- bin/subversion.txt | 2 +- cmd/telegram_loki/main.go | 4 ++++ internal/load_json/load_json.go | 4 ++-- internal/logic/sql/sql.go | 19 +++++++++++-------- pkg/version/version.txt | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 112d28c..07ce942 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /bin/settings/services_add.txt /telegram_users_rapira.json /bin/telegram_users_rapira.json +/bin/sql_test/ diff --git a/bin/date.txt b/bin/date.txt index 750866e..d09a1c7 100644 --- a/bin/date.txt +++ b/bin/date.txt @@ -1 +1 @@ -2024-11-14 07:09:44.548 \ No newline at end of file +2024-11-14 10:37:34.148 \ No newline at end of file diff --git a/bin/subversion.txt b/bin/subversion.txt index f246d72..4e3e037 100644 --- a/bin/subversion.txt +++ b/bin/subversion.txt @@ -1 +1 @@ -00176 \ No newline at end of file +00179 \ No newline at end of file diff --git a/cmd/telegram_loki/main.go b/cmd/telegram_loki/main.go index 590f49f..dc534c4 100644 --- a/cmd/telegram_loki/main.go +++ b/cmd/telegram_loki/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/ManyakRus/starter/config_main" + "github.com/ManyakRus/starter/micro" "github.com/ManyakRus/starter/postgres_pgx" "github.com/ManyakRus/starter/stopapp" "github.com/ManyakRus/starter/telegram_bot" @@ -10,6 +11,7 @@ import ( "github.com/ManyakRus/telegram_loki/internal/load_json" "github.com/ManyakRus/telegram_loki/internal/logic" "github.com/ManyakRus/telegram_loki/internal/telegram" + "github.com/ManyakRus/telegram_loki/pkg/version" ) func main() { @@ -17,6 +19,8 @@ func main() { } func StartApp() { + micro.Show_Version(version.Version) + config_main.LoadENV_or_SettingsTXT() config.FillSettings() load_json.LoadJSON_All() diff --git a/internal/load_json/load_json.go b/internal/load_json/load_json.go index 5273ddf..b22fb2b 100644 --- a/internal/load_json/load_json.go +++ b/internal/load_json/load_json.go @@ -39,7 +39,7 @@ func LoadJSON_All() { FileName = dir + config.Settings.SQL_FILES_FOLDER + micro.SeparatorFile() + "scripts.txt" err = LoadJSON_SQL(FileName) if err != nil { - log.Panic("LoadJSON_Services() error: ", err) + //log.Panic("LoadJSON_Services() error: ", err) } //scripts_add.txt, дополнительный файл, необязательный @@ -96,7 +96,7 @@ func LoadJSON_SQL(FileName string) error { //чтение файла bytes, err := os.ReadFile(FileName) if err != nil { - log.Error("ReadFile() error: ", err) + log.Warn("ReadFile() error: ", err) return err } diff --git a/internal/logic/sql/sql.go b/internal/logic/sql/sql.go index 37a3089..f4db4e2 100644 --- a/internal/logic/sql/sql.go +++ b/internal/logic/sql/sql.go @@ -97,9 +97,13 @@ func RunSQL() (string, error) { if err != nil { DeveloperName, _ = types.MapSQLDeveloper[FilenameShort] DeveloperNameTrim := FindDeveloperName_if_err(FilenameShort, err) - err = fmt.Errorf("%w\n%s", err, DeveloperNameTrim) - log.Warn(err) - return DeveloperName, err + err2 := fmt.Errorf("%w\n%s", err, DeveloperNameTrim) + log.Warn(err2) + + //запомним ошибку + MapLastErrors[FilenameShort] = err.Error() + + return DeveloperName, err2 } } @@ -109,6 +113,10 @@ func RunSQL() (string, error) { // FindDeveloperName_if_err - возвращает имя разработчика, если ошибка другая func FindDeveloperName_if_err(FilenemeShort string, err error) string { // + if err == nil { + return "" + } + //DeveloperName := "" DeveloperName, ok := types.MapSQLDeveloper[FilenemeShort] if ok { @@ -152,11 +160,6 @@ func RunSQL1(Filename string) error { //запомним последнюю ошибку FilenameShort := path.Base(Filename) - TextError := "" - if err != nil { - TextError = err.Error() - } - MapLastErrors[FilenameShort] = TextError //нет строк - это хорошо if err == pgx.ErrNoRows { diff --git a/pkg/version/version.txt b/pkg/version/version.txt index fcd0d3a..7bae6cd 100644 --- a/pkg/version/version.txt +++ b/pkg/version/version.txt @@ -1 +1 @@ -9cfbb6a 2024-11-13 18:03:11 +0300 +eba341e 2024-11-14 10:24:51 +0300