查询聊天室内用户方法

@param  chatroomId:要查询的聊天室 ID。（必传）
@param  count:要获取的聊天室成员数，上限为 500 ，超过 500 时最多返回 500 个成员。（必传）
@param  order:加入聊天室的先后顺序， 1 为加入时间正序， 2 为加入时间倒序。（必传）

@return $json
349998
public function queryUser($chatroomId, $count, $order) {
    	try{
			if (empty($chatroomId))
				throw new Exception('Paramer "chatroomId" is required');

			if (empty($count))
				throw new Exception('Paramer "count" is required');

			if (empty($order))
				throw new Exception('Paramer "order" is required');


    		$params = array (
    		'chatroomId' => $chatroomId,
    		'count' => $count,
    		'order' => $order
    		);

    		$ret = $this->SendRequest->curl('/chatroom/user/query.json',$params,'urlencoded','im','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }
649051
function(params, callback) {
                var count = 50,
                    offset = 0,
                    content = {},
                    whereClause = {},
                    returnCache = false;

                if (params) {
                    if (parseInt(params.count) > 0) {
                        count = params.count;
                    }

                    if (parseInt(params.offset) > 0) {
                        offset = params.offset;
                    }

                    if (typeof params.name === 'string') {
                        content.name = whereClause.name = params.name;
                    }

                    if (Array.isArray(params.threadIds)) {
                        content.threadIds = whereClause.threadIds = params.threadIds;
                    }

                    if (typeof params.new === 'boolean') {
                        content.new = params.new;
                    }

                    if (parseInt(params.creatorCoreUserId) > 0) {
                        content.creatorCoreUserId = whereClause.creatorCoreUserId = params.creatorCoreUserId;
                    }

                    if (parseInt(params.partnerCoreUserId) > 0) {
                        content.partnerCoreUserId = whereClause.partnerCoreUserId = params.partnerCoreUserId;
                    }

                    if (parseInt(params.partnerCoreContactId) > 0) {
                        content.partnerCoreContactId = whereClause.partnerCoreContactId = params.partnerCoreContactId;
                    }
                }

                content.count = count;
                content.offset = offset;

                var sendMessageParams = {
                    chatMessageVOType: chatMessageVOTypes.GET_THREADS,
                    typeCode: params.typeCode,
                    content: content
                };

                /**
                 * Retrieve threads from cache
                 */
                if (canUseCache) {
                    if (db) {
                        var thenAble;

                        if (Object.keys(whereClause).length === 0) {
                            thenAble = db.threads.where('[owner+time]')
                                .between([userInfo.id, minIntegerValue], [userInfo.id, maxIntegerValue * 1000])
                                .reverse();
                        }
                        else {
                            if (whereClause.hasOwnProperty('threadIds')) {
                                thenAble = db.threads.where('id')
                                    .anyOf(whereClause.threadIds)
                                    .and(function(thread) {
                                        return thread.owner == userInfo.id;
                                    });
                            }

                            if (whereClause.hasOwnProperty('name')) {
                                thenAble = db.threads.where('owner')
                                    .equals(userInfo.id)
                                    .filter(function(thread) {
                                        var reg = new RegExp(whereClause.name);
                                        return reg.test(chatDecrypt(thread.title, cacheSecret, thread.salt));
                                    });
                            }

                            if (whereClause.hasOwnProperty('creatorCoreUserId')) {
                                thenAble = db.threads.where('owner')
                                    .equals(userInfo.id)
                                    .filter(function(thread) {
                                        return parseInt(thread.inviter.id) == parseInt(whereClause.creatorCoreUserId);
                                    });
                            }
                        }

                        thenAble.offset(offset)
                            .limit(count)
                            .toArray()
                            .then(function(threads) {
                                db.threads.where('owner')
                                    .equals(userInfo.id)
                                    .count()
                                    .then(function(threadsCount) {
                                        var cacheData = [];

                                        for (var i = 0; i < threads.length; i++) {
                                            try {
                                                var tempData = {},
                                                    salt = threads[i].salt;

                                                cacheData.push(createThread(JSON.parse(chatDecrypt(threads[i].data, cacheSecret, threads[i].salt)), false));
                                            }
                                            catch (error) {
                                                fireEvent('error', {
                                                    code: error.code,
                                                    message: error.message,
                                                    error: error
                                                });
                                            }
                                        }

                                        var returnData = {
                                            hasError: false,
                                            cache: true,
                                            errorCode: 0,
                                            errorMessage: '',
                                            result: {
                                                threads: cacheData,
                                                contentCount: threadsCount,
                                                hasNext: (offset + count < threadsCount && threads.length > 0),
                                                nextOffset: offset + threads.length
                                            }
                                        };

                                        if (cacheData.length > 0) {
                                            callback && callback(returnData);
                                            callback = undefined;
                                            returnCache = true;
                                        }
                                    });
                            })
                            .catch(function(error) {
                                fireEvent('error', {
                                    code: error.code,
                                    message: error.message,
                                    error: error
                                });
                            });
                    }
                    else {
                        fireEvent('error', {
                            code: 6601,
                            message: CHAT_ERRORS[6601],
                            error: null
                        });
                    }
                }

                /**
                 * Retrive get threads response from server
                 */
                return sendMessage(sendMessageParams, {
                    onResult: function(result) {
                        var returnData = {
                            hasError: result.hasError,
                            cache: false,
                            errorMessage: result.errorMessage,
                            errorCode: result.errorCode
                        };

                        if (!returnData.hasError) {

                            var messageContent = result.result,
                                messageLength = messageContent.length,
                                resultData = {
                                    threads: [],
                                    contentCount: result.contentCount,
                                    hasNext: (offset + count < result.contentCount && messageLength > 0),
                                    nextOffset: offset + messageLength
                                },
                                threadData;

                            for (var i = 0; i < messageLength; i++) {
                                threadData = createThread(messageContent[i], false);
                                if (threadData) {
                                    resultData.threads.push(threadData);
                                }
                            }

                            returnData.result = resultData;

                            /**
                             * Updating cache on separated worker to find and
                             * delete all messages that have been deleted from
                             * thread's last section
                             *
                             * This option works on browser only - no Node support
                             * TODO: Implement Node Version
                             */
                            if (typeof Worker !== 'undefined' && productEnv != 'ReactNative' && canUseCache) {
                                if (typeof(cacheSyncWorker) == 'undefined') {
                                    cacheSyncWorker = new Worker('src/browser-worker.js');
                                }

                                var workerCommand = {
                                    type: 'getThreads',
                                    userId: userInfo.id,
                                    data: JSON.stringify(resultData.threads)
                                };

                                cacheSyncWorker.postMessage(JSON.stringify(workerCommand));

                                cacheSyncWorker.onmessage = function(event) {
                                    if (event.data == 'terminate') {
                                        cacheSyncWorker.terminate();
                                        cacheSyncWorker = undefined;
                                    }
                                };

                                cacheSyncWorker.onerror = function(event) {
                                    console.log(event);
                                };
                            }

                            /**
                             * Add Threads into cache database #cache
                             */
                            if (canUseCache) {
                                if (db) {
                                    var cacheData = [];

                                    for (var i = 0; i < resultData.threads.length; i++) {
                                        try {
                                            var tempData = {},
                                                salt = Utility.generateUUID();

                                            tempData.id = resultData.threads[i].id;
                                            tempData.owner = userInfo.id;
                                            tempData.title = Utility.crypt(resultData.threads[i].title, cacheSecret, salt);
                                            tempData.time = resultData.threads[i].time;
                                            tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(resultData.threads[i])), cacheSecret, salt);
                                            tempData.salt = salt;

                                            cacheData.push(tempData);
                                        }
                                        catch (error) {
                                            fireEvent('error', {
                                                code: error.code,
                                                message: error.message,
                                                error: error
                                            });
                                        }
                                    }

                                    db.threads.bulkPut(cacheData)
                                        .catch(function(error) {
                                            fireEvent('error', {
                                                code: error.code,
                                                message: error.message,
                                                error: error
                                            });
                                        });
                                }
                                else {
                                    fireEvent('error', {
                                        code: 6601,
                                        message: CHAT_ERRORS[6601],
                                        error: null
                                    });
                                }
                            }
                        }

                        callback && callback(returnData);
                        /**
                         * Delete callback so if server pushes response before
                         * cache, cache won't send data again
                         */
                        callback = undefined;

                        if (!returnData.hasError && returnCache) {
                            fireEvent('threadEvents', {
                                type: 'THREADS_LIST_CHANGE',
                                result: returnData.result
                            });
                        }
                    }
                });
            }
281929
public function join($userId, $chatroomId) {
    	try{
			if (empty($userId))
				throw new Exception('Paramer "userId" is required');

			if (empty($chatroomId))
				throw new Exception('Paramer "chatroomId" is required');


    		$params = array (
    		'userId' => $userId,
    		'chatroomId' => $chatroomId
    		);

    		$ret = $this->SendRequest->curl('/chatroom/join.json',$params,'urlencoded','im','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }
84333
public JSONObject sendMessageToRoom(String company, String roomId, HashMap<String, String> params) throws JSONException {
        return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
    }
936595
public List<Long> getIds(final int count) throws SnowizardClientException {
        for (final String host : hosts) {
            try {
                final SnowizardResponse snowizard = executeRequest(host, count);
                if (snowizard != null) {
                    return snowizard.getIdList();
                }
            } catch (final Exception ex) {
                LOGGER.warn("Unable to get ID from host ({})", host);
            }
        }
        throw new SnowizardClientException(
                "Unable to generate batch of IDs from Snowizard");
    }
282992
public Response createChatRoom(MUCRoomEntity chatRoom) {
		return restClient.post("chatrooms", chatRoom, new HashMap<String, String>());
	}
1141098
public static function analyze(Order $order) {
        $orderJson = $order->toJsonArray();
        $response = self::requestApi("post", $orderJson);
        $responseJson = $response->getBodyAsJson();
        if (!key_exists("order", $responseJson))
            throw new Exceptions\UnexpectedResponseException("Response has no 'order': $responseJson");
        $newOrder = new Order(array_merge($orderJson, $responseJson["order"]));
        return $newOrder;
    }
362372
public ChatRoomMemberList getChatRoomMembers(long roomId, int start, int count)
            throws APIConnectionException, APIRequestException {
        return _chatRoomClient.getChatRoomMembers(roomId, start, count);
    }
324903
private void setSorts(List<Order> orderBys) {
		for (Order order : orderBys) {
            if (order.getNestedPath() != null) {
                request.addSort(SortBuilders.fieldSort(order.getName()).order(SortOrder.valueOf(order.getType())).setNestedSort(new NestedSortBuilder(order.getNestedPath())));
            } else if (order.getName().contains("script(")) { //zhongshu-comment 该分支是我后来加的，用于兼容order by case when那种情况

				String scriptStr = order.getName().substring("script(".length(), order.getName().length() - 1);
				Script script = new Script(scriptStr);
				ScriptSortBuilder scriptSortBuilder = SortBuilders.scriptSort(script, order.getScriptSortType());

				scriptSortBuilder = scriptSortBuilder.order(SortOrder.valueOf(order.getType()));
				request.addSort(scriptSortBuilder);
			} else {
                request.addSort(
                		order.getName(),
						SortOrder.valueOf(order.getType()));
            }
		}
	}
841191
public function createWebhook($roomId, Webhook $webhook)
    {
        $response = $this->client->post(sprintf('/v2/room/%s/webhook', $roomId), $webhook->toJson());

        return $response['id'];
    }
107142
def chat_search(self, room_id, search_text, **kwargs):
        """"""
        return self.__call_api_get('chat.search', roomId=room_id, searchText=search_text, kwargs=kwargs)
821156
function( json, field, params, callback ){
    field = field || 'id';
    var objectIds = [],
      props;

    if (params.orderByFields && params.orderByFields !== ''){
      var fld = params.orderByFields.split(' ');
      var order = params.orderByFields;
      if (fld[fld.length-1] == 'DESC'){
        order = '-' + params.orderByFields;
      }
      json.features = this.orderBy(json.features, params.orderByFields, order);
    }

    json.features.forEach( function(f){
      props = f.attributes || f.properties;
      objectIds.push( props[ field ] );
    });

    callback( null, {
      objectIdField: field,
      objectIds: objectIds
    });
  }
922633
def create(self, chatRoomInfo):
        

        desc = {
            "name": "CodeSuccessReslut",
            "desc": " http 成功返回结果",
            "fields": [{
                "name": "code",
                "type": "Integer",
                "desc": "返回码，200 为正常。"
            }, {
                "name": "errorMessage",
                "type": "String",
                "desc": "错误信息。"
            }]
        }
        params = {
            'chatroom[{0}]'.format(Id): name
            for Id, name in chatRoomInfo
        }
        r = self.call_api(
            method=('API', 'POST', 'application/x-www-form-urlencoded'),
            action='/chatroom/create.json',
            params=params)
        return Response(r, desc)
1279953
function (obj, count, index) {
    if (obj) {
      if (typeof index !== 'undefined') {
        return obj.columnLabel(index);
      }
      else {
        var headers = [];
        for (var i = 0; i < count; i++) {
          headers.push(obj.columnLabel(i));
        }
        return headers;
      }
    }
  }
1011786
def stopDistributionMessage(self, chatroomId):
        

        desc = {
            "name": "CodeSuccessReslut",
            "desc": " http 成功返回结果",
            "fields": [{
                "name": "code",
                "type": "Integer",
                "desc": "返回码，200 为正常。"
            }, {
                "name": "errorMessage",
                "type": "String",
                "desc": "错误信息。"
            }]
        }
        r = self.call_api(
            method=('API', 'POST', 'application/x-www-form-urlencoded'),
            action='/chatroom/message/stopDistribution.json',
            params={"chatroomId": chatroomId})
        return Response(r, desc)
254068
public function batchget($offset = 0, $count = 10, $status_list = 'CARD_STATUS_VERIFY_OK')
    {
        if (!is_numeric($offset) || $offset < 0) {
            $this->setError('offset 参数不正确');

            return false;
        }

        if (!is_numeric($count) || $count < 0 || $count > 50) {
            $this->setError('count 参数不正确');

            return false;
        }

        $queryStr                = [];
        $queryStr['offset']      = $offset;
        $queryStr['count']       = $count;
        $queryStr['status_list'] = $status_list;

        $this->apitype = 'card';
        $this->module  = 'batchget';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
811435
public function chunk($count, $callback, $column = null, $order = 'asc')
    {
        $column    = $column ?: $this->getPk();
        $options   = $this->getOptions();
        $resultSet = $this->limit($count)->order($column, $order)->select();

        while (!empty($resultSet)) {
            if (false === call_user_func($callback, $resultSet)) {
                return false;
            }
            $end       = end($resultSet);
            $lastId    = is_array($end) ? $end[$column] : $end->$column;
            $resultSet = $this->options($options)
                ->limit($count)
                ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId)
                ->order($column, $order)
                ->select();
        }
        return true;
    }