mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 18:36:19 +08:00
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
This commit is contained in:
commit
6b98c3fed5
@ -6,6 +6,7 @@ import (
|
|||||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -192,12 +193,8 @@ func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
|
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
|
||||||
result, err := redis.Values(d.Exec("SMEMBERS", friendRelationCache+userID))
|
result, err := redis.String(d.Exec("SMEMBERS", friendRelationCache+userID))
|
||||||
var userIDList []string
|
return strings.Split(result, " "), err
|
||||||
for _, v := range result {
|
|
||||||
userIDList = append(userIDList, v.(string))
|
|
||||||
}
|
|
||||||
return userIDList, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...interface{}) error {
|
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...interface{}) error {
|
||||||
@ -211,10 +208,6 @@ func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...interfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
|
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
|
||||||
result, err := redis.Values(d.Exec("SMEMBERS", blackListCache+userID))
|
result, err := redis.String(d.Exec("SMEMBERS", blackListCache+userID))
|
||||||
var userIDList []string
|
return strings.Split(result, " "), err
|
||||||
for _, v := range result {
|
|
||||||
userIDList = append(userIDList, v.(string))
|
|
||||||
}
|
|
||||||
return userIDList, err
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user