示例#1
0
 /**
  * 根据用户Id,获取全部客户端连接ID
  * @param string|array $uid_list 用户ID列表,逗号分隔或一个数组
  * @param bool $remove_current_user 如果为false,那么如果查询结果有当前用户将会保留
  * @return array 返回一个包含指定用户id的客户端连接Id数组
  */
 public static function getClientByUser($uid_list, $remove_current_user = true)
 {
     $in_list = Util::formatIntList($uid_list);
     if (!$in_list) {
         return array();
     }
     $where = "uid IN({$in_list})";
     if ($remove_current_user) {
         $uid = (int) self::getLoggedUserInfo('uid');
         if ($uid) {
             $where .= " AND uid<>{$uid}";
         }
     }
     $db = self::db();
     $table = self::table('message_ucmap');
     $result = $db->select('client_id')->from($table)->where($where)->column();
     return $result ? $result : array();
 }