mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release
This commit is contained in:
@@ -72,7 +72,7 @@ func GetMessageListReactionExtensions(c *gin.Context) {
|
||||
reqPb rpc.GetMessageListReactionExtensionsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
@@ -86,7 +86,7 @@ func GetMessageListReactionExtensions(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ func (r *RPCServer) KickUserOffline(_ context.Context, req *pbRelay.KickUserOffl
|
||||
oldConnMap := ws.getUserAllCons(v)
|
||||
if conn, ok := oldConnMap[int(req.PlatformID)]; ok { // user->map[platform->conn]
|
||||
log.NewWarn(req.OperationID, "send kick msg, close connection ", req.PlatformID, v)
|
||||
ws.sendKickMsg(conn)
|
||||
ws.sendKickMsg(conn, req.OperationID)
|
||||
conn.Close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn
|
||||
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
|
||||
if oldConn, ok := oldConnMap[platformID]; ok {
|
||||
log.NewDebug(operationID, uid, platformID, "kick old conn")
|
||||
ws.sendKickMsg(oldConn)
|
||||
ws.sendKickMsg(oldConn, operationID)
|
||||
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
|
||||
if err != nil && err != go_redis.Nil {
|
||||
log.NewError(operationID, "get token from redis err", err.Error(), uid, constant.PlatformIDToName(platformID))
|
||||
@@ -302,11 +302,12 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn
|
||||
case constant.WebAndOther:
|
||||
}
|
||||
}
|
||||
func (ws *WServer) sendKickMsg(oldConn *UserConn) {
|
||||
func (ws *WServer) sendKickMsg(oldConn *UserConn, operationID string) {
|
||||
mReply := Resp{
|
||||
ReqIdentifier: constant.WSKickOnlineMsg,
|
||||
ErrCode: constant.ErrTokenInvalid.ErrCode,
|
||||
ErrMsg: constant.ErrTokenInvalid.ErrMsg,
|
||||
OperationID: operationID,
|
||||
}
|
||||
var b bytes.Buffer
|
||||
enc := gob.NewEncoder(&b)
|
||||
@@ -422,19 +423,19 @@ func (ws *WServer) getUserAllCons(uid string) map[int]*UserConn {
|
||||
return nil
|
||||
}
|
||||
|
||||
//func (ws *WServer) getUserUid(conn *UserConn) (uid string, platform int) {
|
||||
// rwLock.RLock()
|
||||
// defer rwLock.RUnlock()
|
||||
// func (ws *WServer) getUserUid(conn *UserConn) (uid string, platform int) {
|
||||
// rwLock.RLock()
|
||||
// defer rwLock.RUnlock()
|
||||
//
|
||||
// if stringMap, ok := ws.wsConnToUser[conn]; ok {
|
||||
// for k, v := range stringMap {
|
||||
// platform = k
|
||||
// uid = v
|
||||
// if stringMap, ok := ws.wsConnToUser[conn]; ok {
|
||||
// for k, v := range stringMap {
|
||||
// platform = k
|
||||
// uid = v
|
||||
// }
|
||||
// return uid, platform
|
||||
// }
|
||||
// return uid, platform
|
||||
// return "", 0
|
||||
// }
|
||||
// return "", 0
|
||||
//}
|
||||
func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request, operationID string) (isPass, compression bool) {
|
||||
status := http.StatusUnauthorized
|
||||
query := r.URL.Query()
|
||||
|
||||
@@ -743,6 +743,27 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
||||
resp.ErrMsg = constant.ErrDB.ErrMsg
|
||||
return &resp, nil
|
||||
}
|
||||
reqPb := pbConversation.ModifyConversationFieldReq{Conversation: &pbConversation.Conversation{}}
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.UserIDList = okUserIDList
|
||||
reqPb.FieldType = constant.FieldUnread
|
||||
reqPb.Conversation.GroupID = req.GroupID
|
||||
reqPb.Conversation.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, constant.SuperGroupChatType)
|
||||
reqPb.Conversation.ConversationType = int32(constant.SuperGroupChatType)
|
||||
reqPb.Conversation.UpdateUnreadCountTime = utils.GetCurrentTimestampByMill()
|
||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
}
|
||||
client := pbConversation.NewConversationClient(etcdConn)
|
||||
respPb, err := client.ModifyConversationField(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "ModifyConversationField rpc failed, ", reqPb.String(), err.Error())
|
||||
} else {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "ModifyConversationField success", respPb.String())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if groupInfo.GroupType != constant.SuperGroup {
|
||||
|
||||
@@ -300,18 +300,19 @@ func (rpc *rpcChat) AddMessageReactionExtensions(ctx context.Context, req *msg.A
|
||||
}
|
||||
return &rResp, nil
|
||||
}
|
||||
if !req.IsExternalExtensions {
|
||||
rResp.ErrCode = 200
|
||||
rResp.ErrMsg = "only extenalextensions message can be used"
|
||||
for _, value := range req.ReactionExtensionList {
|
||||
temp := new(msg.KeyValueResp)
|
||||
temp.KeyValue = value
|
||||
temp.ErrMsg = callbackResp.ErrMsg
|
||||
temp.ErrCode = 100
|
||||
rResp.Result = append(rResp.Result, temp)
|
||||
}
|
||||
return &rResp, nil
|
||||
}
|
||||
|
||||
//if !req.IsExternalExtensions {
|
||||
// rResp.ErrCode = 200
|
||||
// rResp.ErrMsg = "only extenalextensions message can be used"
|
||||
// for _, value := range req.ReactionExtensionList {
|
||||
// temp := new(msg.KeyValueResp)
|
||||
// temp.KeyValue = value
|
||||
// temp.ErrMsg = callbackResp.ErrMsg
|
||||
// temp.ErrCode = 100
|
||||
// rResp.Result = append(rResp.Result, temp)
|
||||
// }
|
||||
// return &rResp, nil
|
||||
//}
|
||||
//if ExternalExtension
|
||||
var isHistory bool
|
||||
if req.IsReact {
|
||||
@@ -321,6 +322,7 @@ func (rpc *rpcChat) AddMessageReactionExtensions(ctx context.Context, req *msg.A
|
||||
}
|
||||
rResp.MsgFirstModifyTime = callbackResp.MsgFirstModifyTime
|
||||
rResp.Result = callbackResp.ResultReactionExtensionList
|
||||
rResp.IsReact = callbackResp.IsReact
|
||||
ExtendMessageAddedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, isHistory, false)
|
||||
return &rResp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user