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()) 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) - } } } 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