superGroupMaxSeq

This commit is contained in:
wangchuxiao
2022-07-22 16:55:29 +08:00
parent 337d01008b
commit a5ef78fd1e
4 changed files with 36 additions and 34 deletions
+18 -6
View File
@@ -32,14 +32,9 @@ const (
SignalListCache = "SIGNAL_LIST_CACHE:"
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
groupUserMinSeq = "GROUP_USER_MIN_SEQ:"
groupMaxSeq = "GROUP_MAX_SEQ"
)
//func (d * DataBases)pubMessage(channel, msg string) {
// d.rdb.Publish(context.Background(),channel,msg)
//}
//func (d * DataBases)pubMessage(channel, msg string) {
// d.rdb.Publish(context.Background(),channel,msg)
//}
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
key := accountTempCode + account
n, err := d.RDB.Exists(context.Background(), key).Result()
@@ -101,6 +96,23 @@ func (d *DataBases) GetGroupUserMinSeq(groupID, userID string) (uint64, error) {
return uint64(utils.StringToInt(seq)), err
}
func (d *DataBases) GetGroupMaxSeq(groupID string) (uint64, error) {
key := groupMaxSeq + groupID
seq, err := d.RDB.Get(context.Background(), key).Result()
return uint64(utils.StringToInt(seq)), err
}
func (d *DataBases) IncrGroupMaxSeq(groupID string) (uint64, error) {
key := groupMaxSeq + groupID
seq, err := d.RDB.Incr(context.Background(), key).Result()
return uint64(seq), err
}
func (d *DataBases) SetGroupMaxSeq(groupID string, maxSeq uint32) error {
key := groupMaxSeq + groupID
return d.RDB.Set(context.Background(), key, maxSeq, 0).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)