Merge branch 'v2.3.0release' into superGroup

pull/249/head
wangchuxiao 2 years ago
commit 9e885c2379

@ -65,7 +65,7 @@ func SetPassword(c *gin.Context) {
//userID := utils.Base64Encode(account) //userID := utils.Base64Encode(account)
var userID string var userID string
if params.UserID == "" { 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 := big.NewInt(0)
bi.SetString(userID[0:8], 16) bi.SetString(userID[0:8], 16)
userID = bi.String() userID = bi.String()
@ -82,6 +82,7 @@ func SetPassword(c *gin.Context) {
openIMRegisterReq.Secret = config.Config.Secret openIMRegisterReq.Secret = config.Config.Secret
openIMRegisterReq.FaceURL = params.FaceURL openIMRegisterReq.FaceURL = params.FaceURL
openIMRegisterResp := api.UserRegisterResp{} openIMRegisterResp := api.UserRegisterResp{}
log.NewDebug(params.OperationID, utils.GetSelfFuncName(), "register req:", openIMRegisterReq)
bMsg, err := http2.Post(url, openIMRegisterReq, 2) bMsg, err := http2.Post(url, openIMRegisterReq, 2)
if err != nil { if err != nil {
log.NewError(params.OperationID, "request openIM register error", account, "err", err.Error()) log.NewError(params.OperationID, "request openIM register error", account, "err", err.Error())

@ -233,30 +233,32 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
} }
} }
if len(onlineFailedUserIDList) > 0 {
callbackResp := callbackOfflinePush(pushMsg.OperationID, onlineFailedUserIDList[0], pushMsg.MsgData) callbackResp := callbackOfflinePush(pushMsg.OperationID, onlineFailedUserIDList[0], pushMsg.MsgData)
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp") log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp")
if callbackResp.ErrCode != 0 { if callbackResp.ErrCode != 0 {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp) log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp)
} }
if callbackResp.ActionCode != constant.ActionAllow { if callbackResp.ActionCode != constant.ActionAllow {
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop") log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop")
return return
} }
if offlinePusher == nil { if offlinePusher == nil {
return return
} }
opts, err := GetOfflinePushOpts(pushMsg) opts, err := GetOfflinePushOpts(pushMsg)
if err != nil { if err != nil {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error()) log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error())
} }
log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), onlineFailedUserIDList, content, jsonCustomContent, "opts:", opts) log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), onlineFailedUserIDList, content, jsonCustomContent, "opts:", opts)
pushResult, err := offlinePusher.Push(onlineFailedUserIDList, content, jsonCustomContent, pushMsg.OperationID, opts) pushResult, err := offlinePusher.Push(onlineFailedUserIDList, content, jsonCustomContent, pushMsg.OperationID, opts)
if err != nil { if err != nil {
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
} else { } else {
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData) log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
}
} }
} }
} }

@ -183,7 +183,16 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
n.SendID = sendID n.SendID = sendID
if groupID != "" { if groupID != "" {
n.RecvID = 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 { } else {
n.RecvID = recvUserID n.RecvID = recvUserID
n.SessionType = constant.SingleChatType n.SessionType = constant.SingleChatType

@ -161,9 +161,9 @@ const (
GroupStatusMuted = 3 GroupStatusMuted = 3
//GroupType //GroupType
NormalGroup = 0 NormalGroup = 0
SuperGroup = 1 SuperGroup = 1
DepartmentGroup = 2 WorkingGroup = 2
GroupBaned = 3 GroupBaned = 3
GroupBanPrivateChat = 4 GroupBanPrivateChat = 4

Loading…
Cancel
Save