send message by message receive opt

This commit is contained in:
Gordon
2021-12-07 10:22:49 +08:00
parent 33b9685985
commit d50a0abd2a
2 changed files with 17 additions and 4 deletions
+15 -2
View File
@@ -91,12 +91,25 @@ func (d *DataBases) SetTokenMapByUidPid(userID string, platformID int32, m map[s
_, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
return err
}
func (d *DataBases) SetConversationMsgOpt(userID, conversationID string, opt int) error {
func (d *DataBases) SetSingleConversationMsgOpt(userID, conversationID string, opt int) error {
key := conversationReceiveMessageOpt + userID
_, err1 := d.Exec("HSet", key, conversationID, opt)
return err1
}
func (d *DataBases) GetConversationMsgOpt(userID, conversationID string) (int, error) {
func (d *DataBases) GetSingleConversationMsgOpt(userID, conversationID string) (int, error) {
key := conversationReceiveMessageOpt + userID
return redis.Int(d.Exec("HGet", key, conversationID))
}
func (d *DataBases) GetAllConversationMsgOpt(userID string) (map[string]int, error) {
key := conversationReceiveMessageOpt + userID
return redis.IntMap(d.Exec("HGETALL", key))
}
func (d *DataBases) SetMultiConversationMsgOpt(userID string, m map[string]int) error {
key := conversationReceiveMessageOpt + userID
_, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
return err
}
func (d *DataBases) GetMultiConversationMsgOpt(userID string, conversationIDs []string) ([]int, error) {
key := conversationReceiveMessageOpt + userID
return redis.Ints(d.Exec("hmget", key, redis.Args{}.Add().AddFlat(conversationIDs)...))
}