From 4e5c1606f31f13fe397b198a77820939853bff3f Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 12 Aug 2022 21:48:13 +0800 Subject: [PATCH 1/3] log --- cmd/open_im_api/main.go | 2 +- internal/msg_gateway/gate/ws_server.go | 2 +- internal/msg_transfer/logic/online_history_msg_handler.go | 5 ++--- pkg/base_info/group_api_struct.go | 2 +- pkg/common/db/RedisModel.go | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index e63749da3..0f3307da8 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -41,7 +41,7 @@ func main() { gin.SetMode(gin.ReleaseMode) f, _ := os.Create("../logs/api.log") gin.DefaultWriter = io.MultiWriter(f) - gin.SetMode(gin.DebugMode) + // gin.SetMode(gin.DebugMode) r := gin.Default() r.Use(utils.CorsHandler()) diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index a313b8c51..3698f6d60 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -237,7 +237,7 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOffline failed", callbackResp) } } else { - log.NewWarn(operationID, "normal uid-conn ", uid, platformID, oldConnMap[platformID]) + log.Debug(operationID, "normal uid-conn ", uid, platformID, oldConnMap[platformID]) } } else { diff --git a/internal/msg_transfer/logic/online_history_msg_handler.go b/internal/msg_transfer/logic/online_history_msg_handler.go index 34f950320..a8d23c916 100644 --- a/internal/msg_transfer/logic/online_history_msg_handler.go +++ b/internal/msg_transfer/logic/online_history_msg_handler.go @@ -407,7 +407,7 @@ func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerG rwLock.Unlock() split := 1000 triggerID = utils.OperationIDGenerator() - log.NewWarn(triggerID, "timer trigger msg consumer start", len(ccMsg)) + log.Debug(triggerID, "timer trigger msg consumer start", len(ccMsg)) for i := 0; i < len(ccMsg)/split; i++ { //log.Debug() och.msgDistributionCh <- Cmd2Value{Cmd: ConsumerMsgs, Value: TriggerChannelValue{ @@ -419,9 +419,8 @@ func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerG } //sess.MarkMessage(ccMsg[len(cMsg)-1], "") - log.NewWarn(triggerID, "timer trigger msg consumer end", len(cMsg)) + log.Debug(triggerID, "timer trigger msg consumer end", len(cMsg)) } - } } diff --git a/pkg/base_info/group_api_struct.go b/pkg/base_info/group_api_struct.go index 8918b852c..8f2eaccd4 100644 --- a/pkg/base_info/group_api_struct.go +++ b/pkg/base_info/group_api_struct.go @@ -203,7 +203,7 @@ type SetGroupInfoReq struct { FaceURL string `json:"faceURL"` Ex string `json:"ex"` OperationID string `json:"operationID" binding:"required"` - NeedVerification *int32 `json:"needVerification" ` + NeedVerification *int32 `json:"needVerification"` LookMemberInfo *int32 `json:"lookMemberInfo"` ApplyMemberFriend *int32 `json:"applyMemberFriend"` } diff --git a/pkg/common/db/RedisModel.go b/pkg/common/db/RedisModel.go index 8ad30f878..8c11279ef 100644 --- a/pkg/common/db/RedisModel.go +++ b/pkg/common/db/RedisModel.go @@ -185,14 +185,14 @@ func (d *DataBases) GetMessageListBySeq(userID string, seqList []uint32, operati if err != nil { errResult = err failedSeqList = append(failedSeqList, v) - log2.NewWarn(operationID, "redis get message error:", err.Error(), v) + log2.Debug(operationID, "redis get message error: ", err.Error(), v) } else { msg := pbCommon.MsgData{} err = jsonpb.UnmarshalString(result, &msg) if err != nil { errResult = err failedSeqList = append(failedSeqList, v) - log2.NewWarn(operationID, "Unmarshal err", result, err.Error()) + log2.NewWarn(operationID, "Unmarshal err ", result, err.Error()) } else { log2.NewDebug(operationID, "redis get msg is ", msg.String()) seqMsg = append(seqMsg, &msg) From 1a2ea053612aa20a35c0eef778814563820d14fc Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Sun, 14 Aug 2022 14:09:31 +0800 Subject: [PATCH 2/3] fix bug --- internal/msg_gateway/gate/ws_server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index 3698f6d60..b2ea4c6eb 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -12,9 +12,10 @@ import ( "bytes" "context" "encoding/gob" + "strings" + go_redis "github.com/go-redis/redis/v8" "github.com/pkg/errors" - "strings" //"gopkg.in/errgo.v2/errors" "net/http" @@ -133,6 +134,7 @@ func (ws *WServer) MultiTerminalLoginRemoteChecker(userID string, platformID int resp, err := client.MultiTerminalLoginCheck(context.Background(), req) if err != nil { log.Error(operationID, "MultiTerminalLoginCheck failed ", err.Error()) + continue } if resp.ErrCode != 0 { log.Error(operationID, "MultiTerminalLoginCheck errCode, errMsg: ", resp.ErrCode, resp.ErrMsg) From d5239365be8af63b6aa9ef7ba7721b0b5a400c85 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Sun, 14 Aug 2022 23:34:51 +0800 Subject: [PATCH 3/3] hide jwt not active yet --- pkg/common/token_verify/jwt_token.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/common/token_verify/jwt_token.go b/pkg/common/token_verify/jwt_token.go index 476c26a70..3f9e64fdf 100644 --- a/pkg/common/token_verify/jwt_token.go +++ b/pkg/common/token_verify/jwt_token.go @@ -6,9 +6,10 @@ import ( commonDB "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "Open_IM/pkg/utils" + "time" + go_redis "github.com/go-redis/redis/v8" "github.com/golang-jwt/jwt/v4" - "time" ) //var ( @@ -103,7 +104,9 @@ func GetClaimFromToken(tokensString string) (*Claims, error) { } else if ve.Errors&jwt.ValidationErrorExpired != 0 { return nil, constant.ErrTokenExpired } else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 { - return nil, constant.ErrTokenNotValidYet + log.Error("", "ParseToken failed, ", err.Error(), token) + return nil, nil + // return nil, constant.ErrTokenNotValidYet } else { return nil, constant.ErrTokenUnknown }