From c6380729029bcf6c2c57b6d004fddf8eb13a3665 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 6 Jul 2022 15:28:34 +0800 Subject: [PATCH 1/4] super group add --- internal/rpc/msg/group_notification.go | 11 ++++++++++- pkg/common/constant/constant.go | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go index b24789e23..8d18657a2 100644 --- a/internal/rpc/msg/group_notification.go +++ b/internal/rpc/msg/group_notification.go @@ -183,7 +183,16 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv n.SendID = sendID if groupID != "" { n.RecvID = groupID - n.SessionType = constant.GroupChatType + group, err := imdb.GetGroupInfoByGroupID(groupID) + if err != nil { + log.NewError(operationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID) + } + switch group.GroupType { + case constant.NormalGroup: + n.SessionType = constant.GroupChatType + default: + n.SessionType = constant.SuperGroupChatType + } } else { n.RecvID = recvUserID n.SessionType = constant.SingleChatType diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index fdb1dcb83..ff857ef5c 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -161,9 +161,9 @@ const ( GroupStatusMuted = 3 //GroupType - NormalGroup = 0 - SuperGroup = 1 - DepartmentGroup = 2 + NormalGroup = 0 + SuperGroup = 1 + WorkingGroup = 2 GroupBaned = 3 GroupBanPrivateChat = 4 From 033ec6bc7625ed7ce538a721ffa91d8bcc453c0b Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 6 Jul 2022 16:12:17 +0800 Subject: [PATCH 2/4] fix bug --- internal/demo/register/set_password.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index 2f928efda..c3aab18d2 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -65,7 +65,7 @@ func SetPassword(c *gin.Context) { //userID := utils.Base64Encode(account) var userID string if params.UserID == "" { - userID := utils.Md5(params.OperationID + strconv.FormatInt(time.Now().UnixNano(), 10)) + userID = utils.Md5(params.OperationID + strconv.FormatInt(time.Now().UnixNano(), 10)) bi := big.NewInt(0) bi.SetString(userID[0:8], 16) userID = bi.String() @@ -82,6 +82,7 @@ func SetPassword(c *gin.Context) { openIMRegisterReq.Secret = config.Config.Secret openIMRegisterReq.FaceURL = params.FaceURL openIMRegisterResp := api.UserRegisterResp{} + log.NewDebug(params.OperationID, utils.GetSelfFuncName(), "register req:", openIMRegisterReq) bMsg, err := http2.Post(url, openIMRegisterReq, 2) if err != nil { log.NewError(params.OperationID, "request openIM register error", account, "err", err.Error()) From 3157f97ae616d2c10476db03853057f4669760af Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 6 Jul 2022 16:14:31 +0800 Subject: [PATCH 3/4] push fix bug --- internal/push/logic/push_to_client.go | 48 ++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index ea7a435de..3c5e1b8bc 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -233,30 +233,32 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { } } + if len(onlineFailedUserIDList) > 0 { + callbackResp := callbackOfflinePush(pushMsg.OperationID, onlineFailedUserIDList[0], pushMsg.MsgData) + log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp") + if callbackResp.ErrCode != 0 { + log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp) + } + if callbackResp.ActionCode != constant.ActionAllow { + log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop") + return + } + if offlinePusher == nil { + return + } + opts, err := GetOfflinePushOpts(pushMsg) + if err != nil { + log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error()) + } + log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), onlineFailedUserIDList, content, jsonCustomContent, "opts:", opts) + pushResult, err := offlinePusher.Push(onlineFailedUserIDList, content, jsonCustomContent, pushMsg.OperationID, opts) + if err != nil { + log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) + } else { + log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData) + } + } - callbackResp := callbackOfflinePush(pushMsg.OperationID, onlineFailedUserIDList[0], pushMsg.MsgData) - log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp") - if callbackResp.ErrCode != 0 { - log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp) - } - if callbackResp.ActionCode != constant.ActionAllow { - log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop") - return - } - if offlinePusher == nil { - return - } - opts, err := GetOfflinePushOpts(pushMsg) - if err != nil { - log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error()) - } - log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), onlineFailedUserIDList, content, jsonCustomContent, "opts:", opts) - pushResult, err := offlinePusher.Push(onlineFailedUserIDList, content, jsonCustomContent, pushMsg.OperationID, opts) - if err != nil { - log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) - } else { - log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData) - } } } From 489532320074b9974caa8dd42028718c2e0545fd Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Thu, 7 Jul 2022 07:51:40 +0800 Subject: [PATCH 4/4] fix bug --- pkg/common/constant/constant.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index fdb1dcb83..85de2cb39 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -161,9 +161,10 @@ const ( GroupStatusMuted = 3 //GroupType - NormalGroup = 0 - SuperGroup = 1 - DepartmentGroup = 2 + NormalGroup = 0 + SuperGroup = 1 + WorkingGroup = 2 + // DepartmentGroup = 2 GroupBaned = 3 GroupBanPrivateChat = 4