This commit is contained in:
wangchuxiao 2022-04-28 16:48:39 +08:00
parent b72787f5bb
commit 93057870a7
2 changed files with 6 additions and 5 deletions

View File

@ -187,6 +187,7 @@ func (s *cacheServer) GetFriendIDListFromCache(_ context.Context, req *pbCache.G
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
return resp, nil
}
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), friendIDList)
resp.UserIDList = friendIDList
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
@ -228,6 +229,7 @@ func (s *cacheServer) GetBlackIDListFromCache(_ context.Context, req *pbCache.Ge
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
return resp, nil
}
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), blackUserIDList)
resp.UserIDList = blackUserIDList
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil

View File

@ -6,7 +6,6 @@ import (
pbCommon "Open_IM/pkg/proto/sdk_ws"
"encoding/json"
"github.com/garyburd/redigo/redis"
"strings"
)
const (
@ -193,8 +192,8 @@ func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...interface
}
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
result, err := redis.String(d.Exec("SMEMBERS", friendRelationCache+userID))
return strings.Split(result, " "), err
result, err := redis.Strings(d.Exec("SMEMBERS", friendRelationCache+userID))
return result, err
}
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...interface{}) error {
@ -208,6 +207,6 @@ func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...interfa
}
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
result, err := redis.String(d.Exec("SMEMBERS", blackListCache+userID))
return strings.Split(result, " "), err
result, err := redis.Strings(d.Exec("SMEMBERS", blackListCache+userID))
return result, err
}