mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
redis add message receive opt
This commit is contained in:
parent
a8575b4fc7
commit
70eaa7d968
@ -89,6 +89,11 @@ const (
|
||||
|
||||
OnlineStatus = "online"
|
||||
OfflineStatus = "offline"
|
||||
|
||||
//MsgReceiveOpt
|
||||
ReceiveMessage = 0
|
||||
NotReceiveMessage = 1
|
||||
ReceiveNotNotifyMessage = 2
|
||||
)
|
||||
|
||||
var ContentType2PushContent = map[int64]string{
|
||||
|
@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
userIncrSeq = "REDIS_USER_INCR_SEQ:" // user incr seq
|
||||
appleDeviceToken = "DEVICE_TOKEN"
|
||||
lastGetSeq = "LAST_GET_SEQ"
|
||||
userMinSeq = "REDIS_USER_MIN_SEQ:"
|
||||
uidPidToken = "UID_PID_TOKEN_STATUS:"
|
||||
userIncrSeq = "REDIS_USER_INCR_SEQ:" // user incr seq
|
||||
appleDeviceToken = "DEVICE_TOKEN"
|
||||
userMinSeq = "REDIS_USER_MIN_SEQ:"
|
||||
uidPidToken = "UID_PID_TOKEN_STATUS:"
|
||||
conversationReceiveMessageOpt = "CON_RECV_MSG_OPT:"
|
||||
)
|
||||
|
||||
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
||||
@ -91,15 +91,12 @@ func (d *DataBases) SetTokenMapByUidPid(userID string, platformID int32, m map[s
|
||||
_, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
|
||||
return err
|
||||
}
|
||||
|
||||
//Check exists userid and platform class from redis
|
||||
func (d *DataBases) ExistsUserIDAndPlatform(userID, platformClass string) (int64, error) {
|
||||
key := userID + platformClass
|
||||
return redis.Int64(d.Exec("EXISTS", key))
|
||||
func (d *DataBases) SetConversationMsgOpt(userID, conversationID string, opt int) error {
|
||||
key := conversationReceiveMessageOpt + userID
|
||||
_, err1 := d.Exec("HSet", key, conversationID, opt)
|
||||
return err1
|
||||
}
|
||||
|
||||
//Get platform class Token
|
||||
func (d *DataBases) GetPlatformToken(userID, platformClass string) (string, error) {
|
||||
key := userID + platformClass
|
||||
return redis.String(d.Exec("GET", key))
|
||||
func (d *DataBases) GetConversationMsgOpt(userID, conversationID string) (int, error) {
|
||||
key := conversationReceiveMessageOpt + userID
|
||||
return redis.Int(d.Exec("HGet", key, conversationID))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user