Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release

pull/261/head
skiffer-git 2 years ago
commit cda0fb6a10

@ -2,7 +2,7 @@
# The class cannot be named by Pascal or camel case. # The class cannot be named by Pascal or camel case.
# If it is not used, the corresponding structure will not be set, # If it is not used, the corresponding structure will not be set,
# and it will not be read naturally. # and it will not be read naturally.
serverversion: 2.3.0-rc2 serverversion: 2.3.0
#---------------Infrastructure configuration---------------------# #---------------Infrastructure configuration---------------------#
etcd: etcd:
etcdSchema: openim #默认即可 etcdSchema: openim #默认即可

@ -126,7 +126,7 @@ services:
# STORE_PORT: 3306 # STORE_PORT: 3306
open_im_server: open_im_server:
image: openim/open_im_server:v2.3.0-rc2 image: openim/open_im_server:v2.3.0
container_name: open_im_server container_name: open_im_server
volumes: volumes:
- ./logs:/Open-IM-Server/logs - ./logs:/Open-IM-Server/logs

@ -12,6 +12,7 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/golang/protobuf/ptypes/wrappers" "github.com/golang/protobuf/ptypes/wrappers"
"google.golang.org/grpc"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -227,8 +228,9 @@ func GetGroupAllMemberList(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return return
} }
maxSizeOption := grpc.MaxCallRecvMsgSize(1024 * 1024 * constant.GroupRPCRecvSize)
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupAllMember(context.Background(), req) RpcResp, err := client.GetGroupAllMember(context.Background(), req, maxSizeOption)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetGroupAllMember failed err", err.Error(), req.String()) log.NewError(req.OperationID, "GetGroupAllMember failed err", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})

@ -61,8 +61,8 @@ func (s *groupServer) Run() {
log.NewInfo("", "listen network success, ", address, listener) log.NewInfo("", "listen network success, ", address, listener)
defer listener.Close() defer listener.Close()
//grpc server //grpc server
recvSize := 1024 * 1024 * 30 recvSize := 1024 * 1024 * constant.GroupRPCRecvSize
sendSize := 1024 * 1024 * 30 sendSize := 1024 * 1024 * constant.GroupRPCSendSize
var options = []grpc.ServerOption{ var options = []grpc.ServerOption{
grpc.MaxRecvMsgSize(recvSize), grpc.MaxRecvMsgSize(recvSize),
grpc.MaxSendMsgSize(sendSize), grpc.MaxSendMsgSize(sendSize),

@ -4,6 +4,7 @@ import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db" "Open_IM/pkg/common/db"
rocksCache "Open_IM/pkg/common/db/rocks_cache"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -69,14 +70,14 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
} }
func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) { func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
switch data.MsgData.SessionType {
case constant.SingleChatType:
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
return true, 0, "", nil return true, 0, "", nil
} }
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin { if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
return true, 0, "", nil return true, 0, "", nil
} }
switch data.MsgData.SessionType {
case constant.SingleChatType:
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify) log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
@ -128,6 +129,13 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string
case constant.GroupChatType: case constant.GroupChatType:
fallthrough fallthrough
case constant.SuperGroupChatType: case constant.SuperGroupChatType:
groupInfo, err := rocksCache.GetGroupInfoFromCache(data.MsgData.GroupID)
if err != nil {
return false, 201, err.Error(), nil
}
if groupInfo.GroupType == constant.SuperGroup {
return true, 0, "", nil
} else {
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID} getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
if etcdConn == nil { if etcdConn == nil {
@ -155,7 +163,7 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string
} }
} }
return true, 0, "", cacheResp.UserIDList return true, 0, "", cacheResp.UserIDList
}
default: default:
return true, 0, "", nil return true, 0, "", nil
} }

@ -287,6 +287,11 @@ const (
Directly = 2 //直接进群 Directly = 2 //直接进群
) )
const (
GroupRPCRecvSize = 30
GroupRPCSendSize = 30
)
const FriendAcceptTip = "You have successfully become friends, so start chatting" const FriendAcceptTip = "You have successfully become friends, so start chatting"
func GroupIsBanChat(status int32) bool { func GroupIsBanChat(status int32) bool {

@ -1074,7 +1074,8 @@ func (d *DataBases) GetSuperGroupByUserID(userID string) (UserToSuperGroup, erro
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
var user UserToSuperGroup var user UserToSuperGroup
return user, c.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user) _ = c.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user)
return user, nil
} }
func (d *DataBases) DeleteSuperGroup(groupID string) error { func (d *DataBases) DeleteSuperGroup(groupID string) error {

File diff suppressed because it is too large Load Diff

@ -262,6 +262,8 @@ message MsgData {
OfflinePushInfo offlinePushInfo = 19; OfflinePushInfo offlinePushInfo = 19;
repeated string atUserIDList = 20; repeated string atUserIDList = 20;
bytes msgDataList = 21; bytes msgDataList = 21;
string attachedInfo = 22;
string ex = 23;
} }
message OfflinePushInfo{ message OfflinePushInfo{

Loading…
Cancel
Save