From c17ca47e7d54b45d125b449441c4be297edbd930 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 1 Aug 2022 16:42:07 +0800 Subject: [PATCH 1/3] config file update --- pkg/common/config/config.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index c018ce4c2..217986f05 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -512,11 +512,10 @@ type PDefaultTips struct { func init() { cfgName := os.Getenv("CONFIG_NAME") - fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName, b, filepath.Dir(b)) if len(cfgName) != 0 { Root = cfgName } - + fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName) bytes, err := ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml")) if err != nil { panic(err.Error()) From 22a39ed4d3ef3a881b3eca1a17a602e6c7d6342c Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 1 Aug 2022 16:56:06 +0800 Subject: [PATCH 2/3] config file update --- pkg/common/config/config.go | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 217986f05..f7d7d20f2 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -512,15 +512,28 @@ type PDefaultTips struct { func init() { cfgName := os.Getenv("CONFIG_NAME") - if len(cfgName) != 0 { - Root = cfgName - } fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName) - bytes, err := ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml")) - if err != nil { - panic(err.Error()) - } - if err = yaml.Unmarshal(bytes, &Config); err != nil { - panic(err.Error()) + if len(cfgName) != 0 { + bytes, err := ioutil.ReadFile(filepath.Join(cfgName, "config", "config.yaml")) + if err != nil { + bytes, err = ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml")) + if err != nil { + panic(err.Error()) + } + } else { + Root = cfgName + } + if err = yaml.Unmarshal(bytes, &Config); err != nil { + panic(err.Error()) + } + } else { + bytes, err := ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml")) + if err != nil { + panic(err.Error()) + } + if err = yaml.Unmarshal(bytes, &Config); err != nil { + panic(err.Error()) + } } + } From 18891c554da5f373f6759f770118ecf0dbb08182 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 1 Aug 2022 17:02:56 +0800 Subject: [PATCH 3/3] log add --- internal/push/logic/callback.go | 1 + internal/push/logic/push_to_client.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/push/logic/callback.go b/internal/push/logic/callback.go index cc897322d..5c3c317bf 100644 --- a/internal/push/logic/callback.go +++ b/internal/push/logic/callback.go @@ -92,6 +92,7 @@ func callbackOnlinePush(operationID string, userIDList []string, msg *commonPb.M } func callbackBeforeSuperGroupOnlinePush(operationID string, groupID string, msg *commonPb.MsgData, pushToUserList *[]string) cbApi.CommonCallbackResp { + log.Debug(operationID, utils.GetSelfFuncName(), groupID, msg.String(), pushToUserList) callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable { return callbackResp diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 1ab1ee989..8f4a635c4 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -156,7 +156,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { var wsResult []*pbRelay.SingelMsgToUserResultList isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) - log.Debug(pushMsg.OperationID, "Get super group msg from msg_transfer And push msg", pushMsg.String()) + log.Debug(pushMsg.OperationID, "Get super group msg from msg_transfer And push msg", pushMsg.String(), config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable) var pushToUserIDList []string if config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable { callbackResp := callbackBeforeSuperGroupOnlinePush(pushMsg.OperationID, pushMsg.PushToUserID, pushMsg.MsgData, &pushToUserIDList)