Commit 790d55fa authored by hujiebin's avatar hujiebin

redis nil means 0

parent 89a6028d
......@@ -58,11 +58,12 @@ func (m *RoomManager) UpdateRoomUser(uid uint64, groupId string) error {
func (m *RoomManager) GetLastRoomUserHeartbeat(uid uint64, groupId string) (int64, error) {
key := getRoomUserKey(groupId)
tx, err := m.RedisClient.ZScore(m.Ctx, key, fmt.Sprintf("%d", uid)).Result()
if err != nil {
if err != nil && err != redis.Nil {
mylogrus.MyLog.Errorf("GetLastRoomUserHeartbeat fail:%v", err)
return 0, err
}
return int64(tx), err
// redis nil means 0
return int64(tx), nil
}
func (m *RoomManager) GetAll() *map[string]string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment