mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Filter out disbanded groups
This commit is contained in:
parent
ac536c48cd
commit
5936492f76
@ -1 +1 @@
|
|||||||
Subproject commit 923a29698760e632dee555baec19e295a6ffab42
|
Subproject commit d471ef590b1c00c553821de715d23be03c0c8142
|
@ -248,7 +248,7 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo
|
|||||||
group, err := imdb.GetGroupInfoByGroupID(v)
|
group, err := imdb.GetGroupInfoByGroupID(v)
|
||||||
if num > 0 && owner != nil && err2 == nil && group != nil && err == nil {
|
if num > 0 && owner != nil && err2 == nil && group != nil && err == nil {
|
||||||
if group.Status == constant.GroupStatusDismissed {
|
if group.Status == constant.GroupStatusDismissed {
|
||||||
log.NewError(req.OperationID, "constant.GroupStatusDismissed ", group)
|
log.Info(req.OperationID, "constant.GroupStatusDismissed ", group)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
utils.CopyStructFields(&groupNode, group)
|
utils.CopyStructFields(&groupNode, group)
|
||||||
@ -729,6 +729,10 @@ func (s *groupServer) GetGroupApplicationList(_ context.Context, req *pbGroup.Ge
|
|||||||
log.Error(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), v.GroupID)
|
log.Error(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), v.GroupID)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if group.Status == constant.GroupStatusDismissed {
|
||||||
|
log.Debug(req.OperationID, "group constant.GroupStatusDismissed ", group.GroupID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
user, err := imdb.GetUserByUserID(v.UserID)
|
user, err := imdb.GetUserByUserID(v.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.OperationID, "GetUserByUserID failed ", err.Error(), v.UserID)
|
log.Error(req.OperationID, "GetUserByUserID failed ", err.Error(), v.UserID)
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
accountTempCode = "ACCOUNT_TEMP_CODE"
|
accountTempCode = "ACCOUNT_TEMP_CODE"
|
||||||
resetPwdTempCode = "RESET_PWD_TEMP_CODE"
|
resetPwdTempCode = "RESET_PWD_TEMP_CODE"
|
||||||
@ -35,9 +36,9 @@ const (
|
|||||||
SignalCache = "SIGNAL_CACHE:"
|
SignalCache = "SIGNAL_CACHE:"
|
||||||
SignalListCache = "SIGNAL_LIST_CACHE:"
|
SignalListCache = "SIGNAL_LIST_CACHE:"
|
||||||
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
|
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
|
||||||
|
groupUserMinSeq = "GROUP_USER_MIN_SEQ:"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//func (d * DataBases)pubMessage(channel, msg string) {
|
//func (d * DataBases)pubMessage(channel, msg string) {
|
||||||
// d.rdb.Publish(context.Background(),channel,msg)
|
// d.rdb.Publish(context.Background(),channel,msg)
|
||||||
//}
|
//}
|
||||||
@ -95,6 +96,16 @@ func (d *DataBases) GetUserMinSeq(uid string) (uint64, error) {
|
|||||||
return uint64(utils.StringToInt(seq)), err
|
return uint64(utils.StringToInt(seq)), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DataBases) SetGroupUserMinSeq(groupID, userID string, minSeq uint32) (err error) {
|
||||||
|
key := groupUserMinSeq + "g:" + groupID + "u:" + userID
|
||||||
|
return d.rdb.Set(context.Background(), key, minSeq, 0).Err()
|
||||||
|
}
|
||||||
|
func (d *DataBases) GetGroupUserMinSeq(groupID, userID string) (uint64, error) {
|
||||||
|
key := groupUserMinSeq + "g:" + groupID + "u:" + userID
|
||||||
|
seq, err := d.rdb.Get(context.Background(), key).Result()
|
||||||
|
return uint64(utils.StringToInt(seq)), err
|
||||||
|
}
|
||||||
|
|
||||||
//Store userid and platform class to redis
|
//Store userid and platform class to redis
|
||||||
func (d *DataBases) AddTokenFlag(userID string, platformID int, token string, flag int) error {
|
func (d *DataBases) AddTokenFlag(userID string, platformID int, token string, flag int) error {
|
||||||
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
|
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
|
||||||
|
@ -131,7 +131,7 @@ func (d *DataBases) BatchInsertChat2Cache(userID string, msgList []*pbMsg.MsgDat
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(operationID, "setMessageToCache failed, continue ", err.Error(), len(msgList), userID)
|
log.Error(operationID, "setMessageToCache failed, continue ", err.Error(), len(msgList), userID)
|
||||||
}
|
}
|
||||||
log.NewWarn(operationID, "batch to redis cost time ", getCurrentTimestampByMill()-newTime, userID, len(msgList))
|
log.Debug(operationID, "batch to redis cost time ", getCurrentTimestampByMill()-newTime, userID, len(msgList))
|
||||||
return utils.Wrap(d.SetUserMaxSeq(userID, uint64(currentMaxSeq)), ""), lastMaxSeq
|
return utils.Wrap(d.SetUserMaxSeq(userID, uint64(currentMaxSeq)), ""), lastMaxSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ type User struct {
|
|||||||
CreateTime time.Time `gorm:"column:create_time"`
|
CreateTime time.Time `gorm:"column:create_time"`
|
||||||
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
||||||
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
||||||
|
status int32 `gorm:"column:status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//message BlackInfo{
|
//message BlackInfo{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user