/** * 获取所有在线用户列表 clientid=>name */ public static function getOnlineUsers() { $key = \Config\St\Storekey::USER_ONLINE_LIST; $tryCount = 3; while ($tryCount--) { $clientList = \Vendors\Redis\RedisModel::hashGet(self::$redisServer, $key); if (false === $clientList) { $clientList = array(); } else { return $clientList; } } return $clientList; }
/** * 获取群中某个成员的入群时间 */ public static function getJoinTime($paramArr) { $options = array('master' => '', 'uuid' => '', 'accountid' => ''); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$accountid || !$master || !$uuid) { return false; } $key = self::groupMembersKey($master, $uuid); return RedisModel::hashGet(self::$redisServer, $key, $accountid); }
/** * 根据clientId获取clientName */ public static function getClientnameFromId($clientId) { if (!$clientId) { return false; } return RedisModel::hashGet('webChat', Storekey::USER_ONLINE_LIST, $clientId); }
/** * 获取用户离线消息 */ public static function getUnreadMsg($username) { if (!$username) { return false; } return RedisModel::hashGet(self::$redisServer, $username . \Config\St\Storekey::UNREAD_MSG); }