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

pull/351/head
Gordon 2 years ago
commit 3f87958328

@ -297,8 +297,11 @@ func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err err
log.NewDebug(pushMsg.OperationID, opts) log.NewDebug(pushMsg.OperationID, opts)
} }
} }
opts.IOSBadgeCount = pushMsg.MsgData.OfflinePushInfo.IOSBadgeCount if pushMsg.MsgData.OfflinePushInfo != nil {
opts.IOSPushSound = pushMsg.MsgData.OfflinePushInfo.IOSPushSound opts.IOSBadgeCount = pushMsg.MsgData.OfflinePushInfo.IOSBadgeCount
opts.IOSPushSound = pushMsg.MsgData.OfflinePushInfo.IOSPushSound
}
return opts, nil return opts, nil
} }

@ -3,16 +3,17 @@ package cache
import ( 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/rocks_cache" rocksCache "Open_IM/pkg/common/db/rocks_cache"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbCache "Open_IM/pkg/proto/cache" pbCache "Open_IM/pkg/proto/cache"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"google.golang.org/grpc"
"net" "net"
"strconv" "strconv"
"strings" "strings"
"google.golang.org/grpc"
) )
type cacheServer struct { type cacheServer struct {
@ -67,6 +68,7 @@ func (s *cacheServer) Run() {
log.NewError("0", "RegisterEtcd failed ", err.Error()) log.NewError("0", "RegisterEtcd failed ", err.Error())
panic(utils.Wrap(err, "register cache module rpc to etcd err")) panic(utils.Wrap(err, "register cache module rpc to etcd err"))
} }
go rocksCache.DelKeys()
err = srv.Serve(listener) err = srv.Serve(listener)
if err != nil { if err != nil {
log.NewError("0", "Serve failed ", err.Error()) log.NewError("0", "Serve failed ", err.Error())

@ -142,6 +142,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB) return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
} }
} }
if req.GroupInfo.GroupType != constant.SuperGroup { if req.GroupInfo.GroupType != constant.SuperGroup {
//to group member //to group member
for _, user := range req.InitMemberList { for _, user := range req.InitMemberList {

@ -34,6 +34,20 @@ func InsertIntoGroupMember(toInsertInfo db.GroupMember) error {
return nil return nil
} }
func BatchInsertIntoGroupMember(toInsertInfoList []*db.GroupMember) error {
//MessageList []*model_struct.LocalChatLog
//return utils.Wrap(d.conn.Create(MessageList).Error, "BatchInsertMessageList failed")
for _, toInsertInfo := range toInsertInfoList {
toInsertInfo.JoinTime = time.Now()
if toInsertInfo.RoleLevel == 0 {
toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers
}
toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0)
}
return db.DB.MysqlDB.DefaultGormDB().Create(toInsertInfoList).Error
}
func GetGroupMemberListByUserID(userID string) ([]db.GroupMember, error) { func GetGroupMemberListByUserID(userID string) ([]db.GroupMember, error) {
var groupMemberList []db.GroupMember var groupMemberList []db.GroupMember
err := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error err := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error

@ -36,7 +36,7 @@ const (
conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:" conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:"
) )
func init() { func DelKeys() {
fmt.Println("init to del old keys") fmt.Println("init to del old keys")
for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache, for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache,
groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} { groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} {

@ -36,7 +36,7 @@ func loggerInit(moduleName string) *Logger {
logger.SetLevel(logrus.Level(config.Config.Log.RemainLogLevel)) logger.SetLevel(logrus.Level(config.Config.Log.RemainLogLevel))
//Close std console output //Close std console output
//os.O_WRONLY | os.O_CREATE | os.O_APPEND //os.O_WRONLY | os.O_CREATE | os.O_APPEND
src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_RDWR|os.O_CREATE, os.ModeAppend) src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
if err != nil { if err != nil {
panic(err.Error()) panic(err.Error())
} }

Loading…
Cancel
Save