Filter out disbanded groups

This commit is contained in:
skiffer-git
2022-07-20 10:18:43 +08:00
parent ac536c48cd
commit 5936492f76
5 changed files with 20 additions and 4 deletions
+12 -1
View File
@@ -18,6 +18,7 @@ import (
"strconv"
"time"
)
const (
accountTempCode = "ACCOUNT_TEMP_CODE"
resetPwdTempCode = "RESET_PWD_TEMP_CODE"
@@ -35,9 +36,9 @@ const (
SignalCache = "SIGNAL_CACHE:"
SignalListCache = "SIGNAL_LIST_CACHE:"
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
groupUserMinSeq = "GROUP_USER_MIN_SEQ:"
)
//func (d * DataBases)pubMessage(channel, msg string) {
// 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
}
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
func (d *DataBases) AddTokenFlag(userID string, platformID int, token string, flag int) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)